/* ChatGPT 自助开通客户页。配色与字体沿用 API GET 客户门户（Buddy web/codex/theme.css）。 */
@font-face {
    font-family: PublicSans;
    src: url("/fonts/public-sans.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: JetBrains;
    src: url("/fonts/jetbrains-400.woff2") format("woff2");
    font-display: swap;
}
@font-face {
    font-family: JetBrains;
    src: url("/fonts/jetbrains-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}

:root {
    color-scheme: light;
    --bg: #faf9f5;
    --panel: #fffdf9;
    --surface: #ffffff;
    --surface-soft: #f3f6f2;
    --mint: #e9f4ee;
    --line: #cdd8d1;
    --line-soft: #e3e8e1;
    --text: #1b1f1c;
    --muted: #66706a;
    --accent: #0b6048;
    --accent-hover: #084b38;
    --accent-soft: #dceee3;
    --warn: #855b1c;
    --warn-bg: #fff5df;
    --danger: #b53643;
    --danger-bg: #fcecef;
    --blue: #286980;
    --blue-bg: #eaf3f7;
    --shadow: 0 12px 32px rgba(26, 63, 49, 0.05);
    --radius: 10px;
    --sans: PublicSans, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: JetBrains, ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.7 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}
code, pre { font-family: var(--mono); }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 32px;
    height: 72px;
    padding: 0 clamp(16px, 5vw, 76px);
    border-bottom: 1px solid var(--line);
    background: rgba(250, 249, 245, 0.95);
    backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font: 600 19px/1 var(--mono); letter-spacing: 0.04em; color: var(--accent); }
.brand-copy small { margin-top: 5px; font-size: 12px; color: var(--muted); }
.main-nav { display: flex; gap: 28px; margin-left: auto; }
.main-nav a { position: relative; padding: 8px 0; font-size: 15px; color: var(--muted); transition: color 0.2s; }
.main-nav a:hover, .main-nav a.is-active { color: var(--text); }
.main-nav a.is-active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: var(--accent);
}

/* ---------- sections ---------- */
main { max-width: 1152px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.section { padding: 44px 0 12px; }
.section + .section { padding-top: 56px; }
.section-heading { display: block; margin-bottom: 22px; }
.section-heading .section-index { display: block; }
.section-heading h1, .section-heading h2 { margin: 6px 0 6px; font-size: clamp(26px, 3.2vw, 32px); line-height: 1.25; letter-spacing: -0.01em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 15px; }
.section-heading-split { display: flex; gap: 20px; justify-content: space-between; align-items: flex-end; }
.section-index { font: 600 13px var(--mono); color: var(--accent); letter-spacing: 0.06em; white-space: nowrap; }

.security-note {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #b9d9c8;
    border-radius: var(--radius);
    background: var(--mint);
    color: var(--accent);
    flex: none;
}
.security-note .icon { width: 22px; height: 22px; }
.security-note strong { display: block; font-size: 14px; }
.security-note small { display: block; color: #35574a; font-size: 13px; }

/* ---------- flow card ---------- */
.flow-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface-soft);
}
.stepper li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    color: var(--muted);
    font-size: 15px;
    white-space: nowrap;
}
.stepper li + li::before {
    content: "";
    position: absolute;
    left: 0; top: 18px; bottom: 18px;
    width: 1px;
    background: var(--line);
}
.step-num {
    display: inline-grid;
    place-items: center;
    width: 30px; height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    font: 600 12px var(--mono);
    flex: none;
}
.stepper li.is-active { color: var(--text); font-weight: 600; }
.stepper li.is-active .step-num { border-color: var(--accent); background: var(--accent); color: #fff; }
.stepper li.is-done .step-num { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.stepper li.is-active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--accent);
}

.step-panel { padding: 32px clamp(18px, 4vw, 36px) 36px; }
.step-panel-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; }
.panel-eyebrow { display: block; font: 600 12px var(--mono); letter-spacing: 0.14em; color: var(--muted); }
.step-panel h2 { margin: 8px 0 6px; font-size: 24px; line-height: 1.3; }
.panel-desc { margin: 0 0 20px; color: var(--muted); }

.field-label { display: block; margin: 18px 0 8px; font-weight: 600; font-size: 15px; }
.req { color: var(--danger); }
.field-hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.field-error {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--warn-bg);
    color: var(--warn);
    font-size: 14px;
}

.prefixed-input {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.prefixed-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.prefixed-input .prefix {
    display: grid;
    place-items: center;
    padding: 0 14px;
    border-right: 1px solid var(--line-soft);
    background: var(--surface-soft);
    color: var(--accent);
    font: 600 12px var(--mono);
    letter-spacing: 0.1em;
}
.prefixed-input input, .query-input input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    font-family: var(--mono);
    font-size: 15px;
    letter-spacing: 0.02em;
}
.prefixed-input input:focus, .query-input input:focus { outline: none; }
input::placeholder, textarea::placeholder { color: #9aa39d; font-family: var(--sans); letter-spacing: 0; }

textarea {
    display: block;
    width: 100%;
    min-height: 148px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font: 13px/1.6 var(--mono);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.is-valid { border-color: #8fc2a8; }
textarea.is-invalid { border-color: #d9b46e; }

/* ---------- buttons ---------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(11, 96, 72, 0.16); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; margin-top: 24px; }
.btn-icon { width: 18px; height: 18px; }
.spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.actions .btn-primary { margin-left: auto; }

/* ---------- step 1 aside ---------- */
.plan-aside {
    align-self: start;
    padding: 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--surface-soft);
}
.aside-title { display: block; margin-bottom: 10px; font: 600 12px var(--mono); letter-spacing: 0.12em; color: var(--muted); }
.plan-list { margin: 0; padding: 0; list-style: none; }
.plan-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px dashed var(--line);
}
.plan-list li:first-child { border-top: 0; }
.plan-list strong { display: block; font-size: 15px; }
.plan-list small { display: block; color: var(--muted); font-size: 13px; }
.plan-match {
    display: none;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font: 600 12px var(--sans);
    font-style: normal;
}
.plan-list li.is-matched strong { color: var(--accent); }
.plan-list li.is-matched .plan-match { display: inline-block; }
.plan-list.has-match li:not(.is-matched) { opacity: 0.5; }
.aside-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- step 2 ---------- */
.verified-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 12px 0 22px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--mint);
    font-size: 14px;
}
.vs-item { display: inline-flex; gap: 10px; align-items: baseline; min-width: 0; }
.vs-label { color: #35574a; }
.vs-item code { font-size: 13px; word-break: break-all; }
.vs-item strong { color: var(--accent); }
.link-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.link-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.2s, background 0.2s;
}
.link-step:hover { border-color: var(--accent); background: var(--mint); }
.link-step .icon { margin-left: auto; color: var(--muted); }
.link-num {
    display: inline-grid;
    place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font: 600 13px var(--mono);
    flex: none;
}
.link-copy strong { display: block; font-size: 15px; }
.link-copy small { display: block; color: var(--muted); font-size: 13px; }
.session-feedback {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 10px 0 0;
    font-size: 14px;
}
.session-feedback.is-ok { color: var(--accent); }
.session-feedback.is-error { color: var(--warn); }
.session-feedback .icon { width: 16px; height: 16px; }

/* ---------- step 3 ---------- */
.confirm-list {
    margin: 18px 0 0;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--surface);
}
.confirm-list > div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
}
.confirm-list > div:first-child { border-top: 0; }
.confirm-list dt { color: var(--muted); }
.confirm-list dd { margin: 0; font-weight: 600; word-break: break-all; }
.confirm-list code { font-size: 14px; font-weight: 400; }
.confirm-note {
    margin: 14px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--blue-bg);
    color: var(--blue);
    font-size: 14px;
}

/* ---------- step 4 ---------- */
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.state-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.state-running { border: 1px solid #9cc9b2; color: var(--accent); background: var(--surface); }
.state-success { background: var(--accent); color: #fff; }
.state-review { background: var(--blue-bg); color: var(--blue); }
.state-failed { background: var(--warn-bg); color: var(--warn); }
.progress-message { margin: 8px 0 18px; color: var(--muted); min-height: 1.7em; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; border: 1px solid var(--line-soft); }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.5s ease; }
.progress-bar.is-running { background-image: linear-gradient(90deg, var(--accent) 0%, #2f8d6e 50%, var(--accent) 100%); background-size: 200% 100%; animation: flow 2.4s linear infinite; }
.progress-bar.is-review { background: var(--blue); }
.progress-bar.is-failed { background: #c9a25a; }
@keyframes flow { to { background-position: -200% 0; } }
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font: 13px var(--mono); color: var(--muted); }
.conn::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.conn.is-offline::before { background: #c9a25a; }
.progress-ref { margin: 6px 0 0; font: 12px var(--mono); color: var(--muted); }
.result-note {
    margin: 22px 0 0;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface-soft);
    font-size: 15px;
}

/* ---------- query ---------- */
.query-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.query-card, .query-result {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
}
.query-card .field-label { margin-top: 0; }
.query-input {
    display: flex;
    gap: 8px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.query-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.query-input input { height: 46px; padding: 0 12px; }
.query-input .btn { min-height: 46px; padding: 0 18px; box-shadow: none; }
.query-input .btn.is-loading .icon { display: none; }
.query-result { display: flex; flex-direction: column; justify-content: center; min-height: 168px; }
.query-result.is-empty { border-style: dashed; background: transparent; }
.empty-state { text-align: center; color: var(--muted); font-size: 14px; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 16px; }
.qr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.qr-head code { font-size: 13px; color: var(--muted); word-break: break-all; }
.qr-rows { margin: 0; }
.qr-rows > div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line-soft); font-size: 15px; }
.qr-rows dt { color: var(--muted); }
.qr-rows dd { margin: 0; }
.query-result .btn { margin-top: 14px; align-self: flex-start; }

/* ---------- help ---------- */
.help-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.faq-list { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.faq-list details + details { border-top: 1px solid var(--line-soft); }
.faq-list summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary:hover { color: var(--accent); }
.faq-list summary .icon { color: var(--muted); transition: transform 0.2s; }
.faq-list details[open] summary .icon { transform: rotate(180deg); color: var(--accent); }
.faq-list details p { margin: 0; padding: 0 20px 18px; color: var(--muted); font-size: 15px; }
.guide-card { padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.guide-card h3 { margin: 0 0 10px; font-size: 18px; }
.guide-card ol { margin: 0; padding-left: 20px; font-size: 15px; }
.guide-card li + li { margin-top: 4px; }
.guide-card a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.guide-sample {
    margin: 14px 0 0;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #17251f;
    color: #d6eadf;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}
.guide-foot { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.guide-foot code { padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); color: var(--text); }

/* ---------- footer ---------- */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 64px;
    padding: 22px clamp(16px, 5vw, 76px);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}
.site-footer strong { color: var(--accent); font-family: var(--mono); margin-right: 8px; }
.site-footer a:hover { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
    .step-panel-split { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .query-grid, .help-grid { grid-template-columns: minmax(0, 1fr); }
    .section-heading-split { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
    body { font-size: 15px; }
    .site-header { height: 60px; gap: 12px; }
    .brand-copy small { display: none; }
    .main-nav { gap: 16px; }
    .main-nav a { font-size: 14px; }
    .section { padding-top: 28px; }
    .section + .section { padding-top: 40px; }
    .security-note { width: 100%; }
    .stepper li { flex-direction: column; gap: 4px; padding: 12px 4px; font-size: 12px; }
    .stepper li + li::before { top: 12px; bottom: 12px; }
    .step-num { width: 28px; height: 28px; }
    .step-panel { padding: 24px 16px 28px; }
    .step-panel h2 { font-size: 21px; }
    .link-steps { grid-template-columns: 1fr; }
    .confirm-list > div { grid-template-columns: 84px minmax(0, 1fr); padding: 12px 14px; }
    .actions { flex-direction: column-reverse; }
    .actions .btn { width: 100%; margin-left: 0; }
    .query-card, .query-result { padding: 18px; }
    .site-footer { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 360px) {
    .main-nav a:nth-child(3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
