/* Shared warm-paper surfaces. Load after the existing page styles.
   Homepage composition, proof stages and upload/dropzone geometry stay local. */
:root {
  --surface-rule: rgba(23, 19, 15, .11);
  --surface-rule-strong: rgba(23, 19, 15, .24);
  --surface-inset: #f0eadd;
  --surface-quiet: #6c6257;
  --surface-input-line: #978675;
  --code-paper: #efe9dd;
  --code-ink: #3b332a;
}

body {
  background: var(--paper);
  caret-color: var(--signal-strong);
  scrollbar-color: #b9ae9d var(--paper);
}
body::before { content: none; }
/* A document field carries the converter's visual language beyond its hero. */
main { position: relative; isolation: isolate; }
main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 65% 480px at 90% 26%, #c7d2b32b, transparent), radial-gradient(ellipse 55% 500px at 8% 72%, #e6b88e20, transparent);
}
body[data-home-page] #capability-directory,
body[data-home-page] #access-methods,
body[data-converter-page] .content-section,
body.source-page .faq-section {
  position: relative;
  isolation: isolate;
}
body[data-home-page] #capability-directory::before,
body[data-home-page] #access-methods::before,
body[data-converter-page] main::after,
body[data-docs-page] main::after,
body[data-pricing-page] main::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  width: min(960px,100%);
  height: 600px;
  right: 0;
  top: -130px;
  background: url('/document-field.svg') right top / contain no-repeat;
}
body[data-home-page] #access-methods::before { top: -90px; opacity: .6; }
body[data-converter-page] main::after { top: 600px; }
body[data-docs-page] main::after,
body[data-pricing-page] main::after { top: 120px; }
:is(h1,h2,h3) { text-wrap: balance; }
@supports (animation-timeline: view()) {
  @media(prefers-reduced-motion:no-preference) {
    body[data-home-page] #capability-directory::before {
      animation: document-field-pass linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
  }
}
@keyframes document-field-pass { from { transform: translateY(32px); opacity: .5; } to { transform: translateY(-24px); opacity: 1; } }
@media(max-width:760px) {
  body[data-home-page] #capability-directory::before,
  body[data-home-page] #access-methods::before,
  body[data-converter-page] main::after { top: -30px; opacity: .7; height: 420px; }
  body[data-converter-page] main::after { top: 500px; }
}
::selection { background: #eed3be; color: var(--ink); }
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Shared navigation retains its existing desktop and mobile arrangement. */
body .site-header {
  min-height: 72px;
  border-bottom-color: transparent;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: none;
}
.site-header .nav-links {
  border-color: var(--surface-rule);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: none;
  font-size: .9rem;
}
.site-header :is(.account-link, .task-inbox-trigger, .site-menu-toggle) {
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}
.site-header .account-link.is-authenticated { background: var(--surface-sunken); }
/* The account-menu trigger is a button (not a <summary>): reset UA chrome
   so it keeps the account-link pill shape. */
.site-header .header-account-menu > .account-link {
  appearance: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}
.header-account-popover[hidden] { display: none; }
.site-header .header-account-popover {
  border-color: var(--surface-rule);
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(45, 32, 20, .1);
}
.site-header :is(.nav-links a, .account-link, .task-inbox-trigger, .site-menu-toggle) {
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.site-header :is(.account-link, .task-inbox-trigger, .site-menu-toggle):hover,
.header-account-popover :is(a, button):hover {
  border-color: var(--surface-rule-strong);
  background: var(--surface-inset);
  color: var(--ink);
}
.site-header .nav-links a[aria-current="page"] {
  background: var(--ink);
  color: var(--surface);
}
body:not([data-home-page]) .site-footer {
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}

/* Converter and provider explanations use the same open reading surface. */
body[data-converter-page] .hero-shell {
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .hero-copy h1 {
  letter-spacing: -.025em;
  text-wrap: balance;
}
body.source-page[data-converter-page] .hero-copy h1 {
  font-size: clamp(2.5rem, 4.7vw, 4.1rem);
  line-height: 1.03;
}
body[data-converter-page] :is(.hero-lede, .source-boundary) {
  color: var(--surface-quiet);
  line-height: 1.65;
}
body[data-converter-page] .section-band {
  width: min(1120px, calc(100% - 64px));
  padding-block: clamp(40px, 5vw, 64px);
  border-color: var(--surface-rule);
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .section-heading {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 24px 56px;
  align-items: start;
}
body[data-converter-page] .section-heading h2 {
  margin-top: 0;
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  text-wrap: balance;
}
body[data-converter-page] .section-heading > p {
  max-width: 66ch;
  margin-top: 0;
  color: var(--surface-quiet);
  font-size: .97rem;
  line-height: 1.75;
}
body[data-converter-page] :is(.flow-steps, .developer-lanes) > article {
  border: 0;
  border-top: 1px solid var(--surface-rule);
  border-radius: var(--r-0);
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .developer-lanes > article { padding: 24px 0; }
body[data-converter-page] .converter-tool-discovery {
  border-color: var(--surface-rule);
  background: transparent;
}
body[data-converter-page] .converter-tool-discovery a {
  border-color: var(--surface-rule);
  color: var(--surface-quiet);
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 600;
}
body[data-converter-page] .converter-tool-discovery a:hover,
body[data-converter-page] .converter-tool-discovery a[aria-current="page"] {
  background: var(--surface-inset);
  color: var(--ink);
}
body[data-converter-page] .faq-section details {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--surface-rule);
  border-radius: var(--r-0);
  background: transparent;
  box-shadow: none;
}
body[data-converter-page] .faq-section summary {
  min-height: 44px;
  padding-block: 20px;
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.5;
}
body[data-converter-page] .faq-section details p {
  max-width: 72ch;
  margin: 0 0 22px;
  color: var(--surface-quiet);
  font-size: .94rem;
  line-height: 1.7;
}

/* Account overview and settings: large paper surfaces, quiet inset groups. */

/* Authentication and native dialogs keep their existing focus and scroll model. */
.auth-card {
  padding: clamp(24px, 4vw, 36px);
  border-color: var(--surface-rule);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(45, 32, 20, .08);
}
.auth-card-title h2,
.auth-gate-title h2 { font-weight: 600; letter-spacing: -.025em; line-height: 1.08; }
.auth-card-title p:last-child { color: var(--surface-quiet); line-height: 1.6; }
.auth-gate-card { padding-top: 48px; }
:is(.auth-gate-dialog, .surface-dialog)::backdrop {
  background: rgba(40, 32, 25, .38);
  backdrop-filter: blur(4px);
}
:is(.auth-tabs, .verification-mark) {
  border-color: var(--surface-rule);
  background: var(--paper);
}
.auth-tabs button.active { background: var(--surface); box-shadow: none; }
.auth-card .auth-form { padding: 0; border: 0; background: transparent; }
.social-button { border-color: var(--surface-rule-strong); background: var(--surface); box-shadow: none; font-weight: 600; }
.social-button:not(:disabled):hover { border-color: var(--ink); background: var(--paper); box-shadow: none; transform: none; }
:is(.auth-gate-close, .surface-dialog-close, .feedback-close) {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--surface-rule);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}
:is(.auth-gate-close, .surface-dialog-close, .feedback-close):hover { background: var(--surface-inset); border-color: var(--surface-rule-strong); }
:is(.task-inbox-shell) { border-color: var(--surface-rule); background: var(--surface); box-shadow: -12px 0 44px rgba(45, 32, 20, .1); }
:is(.surface-dialog-header) h2 { font-size: clamp(1.8rem, 2.7vw, 2.35rem); font-weight: 600; line-height: 1.12; }
.task-inbox-item { border-color: var(--surface-rule); border-radius: 9px; background: var(--paper); }
.task-inbox-empty { border: 0; background: var(--paper); }
.task-inbox-copy strong { font-weight: 600; }
.task-inbox-copy span { color: var(--surface-quiet); }
.result-panel { border-color: var(--surface-rule); border-radius: var(--r-lg); background: var(--surface); box-shadow: none; }
.result-panel h2 { font-weight: 600; line-height: 1.12; letter-spacing: -.015em; }
.result-review-warning { border-color: #dec2a4; background: #f6ecdc; color: #6c4f28; }

/* Inputs and actions retain useful boundaries; dark primary labels stay white. */
:is(.auth-card) :is(input, select, textarea),
#feedback-form :is(input, textarea) {
  border-color: var(--surface-input-line);
  background: var(--surface);
  color: var(--ink);
}
:is(.auth-card) :is(input, select, textarea):focus,
#feedback-form :is(input, textarea):focus {
  border-color: var(--signal-strong);
  outline: 2px solid var(--signal-strong);
  outline-offset: 2px;
  box-shadow: none;
}
:is(.auth-card) :is(input, textarea)::placeholder,
#feedback-form :is(input, textarea)::placeholder { color: #7d7063; opacity: 1; }
:is(.auth-card) button,
.result-actions :is(a, button),
.feedback-submit {
  min-height: 44px;
  font-weight: 600;
  box-shadow: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.result-actions :is(a, button) { font-weight: 600; }
:is(.auth-card) .ghost-action,
.result-actions .secondary { border-color: var(--surface-rule-strong); background: var(--surface); color: var(--ink); }
:is(.auth-card) .text-action { background: transparent; color: var(--surface-quiet); }
:is(.auth-card) :is(.ghost-action, .text-action):not(:disabled):hover,
.result-actions .secondary:hover { background: var(--surface-inset); color: var(--ink); }
:is(.task-inbox-actions, .result-actions) button:not(.secondary):not(:disabled):hover { background: var(--ink-soft); color: var(--surface); }

.feedback-toggle { min-height: 44px; border-color: var(--surface-rule); background: var(--surface); box-shadow: 0 4px 16px rgba(45, 32, 20, .06); }
.feedback-panel { border-color: var(--surface-rule); border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 16px 44px rgba(45, 32, 20, .13); }
.feedback-panel h2 { font-weight: 600; line-height: 1.12; }
.feedback-submit { background: var(--signal-strong); color: var(--surface); font-weight: 600; }
.feedback-submit:not(:disabled):hover { background: #a93716; }

/* Shared light code palette, excluding the separately maintained homepage proof. */
body:not([data-home-page]) .code-frame,
.surface-dialog .code-frame { border-color: var(--surface-rule); border-radius: 10px; background: var(--code-paper); box-shadow: none; }
body:not([data-home-page]) .code-toolbar,
.surface-dialog .code-toolbar { border-color: var(--surface-rule); background: var(--code-paper); }
body:not([data-home-page]) .code-frame pre.copyable-code,
.surface-dialog .code-frame pre.copyable-code { background: var(--code-paper); color: var(--code-ink); font-size: .82rem; line-height: 1.75; }
:is(.docs-page) .connection-panel-setup .code-frame code,
body:not([data-home-page]) .code-frame code { color: var(--code-ink); }
body:not([data-home-page]) .code-frame .copy-button,
.surface-dialog .code-frame .copy-button { min-height: 36px; border-color: var(--surface-rule-strong); background: var(--surface); color: var(--code-ink); font-weight: 600; box-shadow: none; }
body:not([data-home-page]) .code-frame .copy-button:hover,
.surface-dialog .code-frame .copy-button:hover { background: #e6decf; }
.code-scroll:focus-visible { outline: 2px solid transparent; outline-offset: 0; box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--signal); }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.comment, .syntax-comment) { color: #6f6559; font-style: italic; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.keyword, .syntax-keyword) { color: #954821; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.string, .syntax-string) { color: #39604a; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.number, .syntax-number, .token.boolean, .syntax-boolean) { color: #855627; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.function, .syntax-function) { color: #6f4e77; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.property, .syntax-property, .token.attr-name, .syntax-key) { color: #345e62; }
:is(body:not([data-home-page]), .surface-dialog) :is(.code-frame) :is(.token.operator, .token.punctuation, .syntax-operator, .syntax-punctuation) { color: #726151; }

/* Legal pages read as a document, without a separate card for every paragraph. */
.legal-page { max-width: 1000px; }
.legal-page .page-hero { max-width: 760px; margin-inline: auto; }
.legal-page .page-hero h1 { font-size: clamp(2.6rem, 5vw, 4.25rem); line-height: 1.04; letter-spacing: -.025em; }
.legal-page .doc-stack { max-width: 760px; margin-inline: auto; gap: 0; }
.legal-page .doc-section { padding: 30px 0; border: 0; border-top: 1px solid var(--surface-rule); border-radius: var(--r-0); background: transparent; }
.legal-page .doc-section h2 { margin: 0 0 14px; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.legal-page .doc-section :is(p, li) { color: var(--surface-quiet); font-size: 1rem; line-height: 1.8; }
.legal-page .doc-section p:last-child { margin-bottom: 0; }
.legal-page .doc-section a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--surface-rule-strong); text-underline-offset: 3px; }
.legal-page .doc-section a:hover { color: var(--signal-strong); text-decoration-color: currentColor; }

@media (max-width: 760px) {
  body .site-header { min-height: 64px; }
  body[data-converter-page] .section-band { width: calc(100% - 36px); padding-block: 36px; }
  body[data-converter-page] .section-heading { grid-template-columns: 1fr; gap: 12px; }
  body[data-converter-page] .section-heading h2 { max-width: 26ch; margin-bottom: 0; }
  body[data-converter-page] .section-heading > p { font-size: .94rem; }
  .auth-card { padding: 28px 22px; }
  .auth-gate-card { padding-top: 50px; }
  :is(.auth-card) :is(input, select, textarea),
#feedback-form :is(input, textarea) { font-size: var(--fs-body); }
  .feedback-panel { padding: 22px 18px; max-height: calc(100dvh - 96px); }
  .task-inbox-item { grid-template-columns: auto minmax(0, 1fr); }
  .task-inbox-actions { grid-column: 2; flex-wrap: wrap; }
  .legal-page .doc-section { padding-block: 26px; }
  .legal-page .doc-section h2 { font-size: 1.45rem; }
}

/* Task inbox rows: the filename slot can never collapse behind the action row —
   copy and dismiss sit on row one, actions and the delete-confirm bar on row two. */
.task-inbox-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "marker copy dismiss"
    "marker actions actions"
    "marker confirm confirm";
  align-items: start;
}
.task-status-marker { grid-area: marker; margin-top: 6px; }
.task-inbox-copy { grid-area: copy; }
.task-inbox-actions {
  grid-area: actions;
  justify-self: end;
  flex-wrap: wrap;
}
.task-inbox-actions:empty { display: none; }
.task-inbox-dismiss {
  grid-area: dismiss;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 28px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.task-inbox-dismiss svg { display: block; }
.task-inbox-dismiss:hover,
.task-inbox-dismiss:focus-visible {
  background: color-mix(in srgb, var(--coral-soft) 70%, transparent);
  color: var(--signal-strong);
}
.task-inbox-dismiss:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.task-inbox-confirm {
  grid-area: confirm;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.task-inbox-confirm[hidden] { display: none; }
.task-inbox-confirm-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--signal-strong);
}
.task-inbox-confirm.is-busy .task-inbox-confirm-icon svg { display: none; }
.task-inbox-confirm.is-busy .task-inbox-confirm-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid color-mix(in srgb, var(--signal-strong) 25%, transparent);
  border-top-color: var(--signal-strong);
  border-radius: 50%;
  animation: task-inbox-spin 0.7s linear infinite;
}
@keyframes task-inbox-spin {
  to { transform: rotate(360deg); }
}
.task-inbox-confirm-text {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.task-inbox-confirm-actions {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.task-inbox-confirm button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  font: 700 0.74rem/1.2 var(--sans);
}
.task-inbox-confirm button.danger {
  border: 1px solid var(--signal-strong);
  background: var(--signal-strong);
  color: #fff;
}
.task-inbox-confirm button.danger:not(:disabled):hover {
  background: color-mix(in srgb, var(--signal-strong) 88%, #000);
}
.task-inbox-confirm button.secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.task-inbox-confirm button:disabled {
  cursor: default;
  opacity: 0.6;
}
.task-inbox-item[data-confirming="true"] .task-status-marker { margin-top: 4px; }
/* Action-row buttons carry a 13px glyph before the label — inline-flex keeps
   icon and text on one line without disturbing the row's wrap behaviour. */
.task-inbox-actions button,
.task-inbox-actions .ghost-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.task-action-icon { flex-shrink: 0; }

/* Two-option billing choices read faster as a left/right segment than a dropdown. */
/* The plan step carries 2–3 longer labels; a rounded row reads better than a
   pill cluster when the options wrap. */
/* display rules above must not resurrect [hidden] options or the dismiss
   control while its confirm bar is open. */
.task-inbox-dismiss[hidden] { display: none !important; }
/* The picked segment points at the review panel so the left→right link is
   visible even before the summary pulse fires. */
/* Scope to the group so the unselected option stays transparent — the broad
   .app-card button rule in styles.css would otherwise paint every segment ink. */

/* brand.css re-inks .app-page small at 14px with higher specificity than the
   parity layer's font-size:0 trick, which made "Secure checkout" render twice
   (element text + ::after). Restore the pseudo-element-only rendering. */

/* Changing a left-side choice visibly pulses the review panel so the link
   between selection and summary is impossible to miss. */
.billing-checkout-summary { transition: border-color var(--dur-2) ease, background var(--dur-2) ease; }
.billing-checkout-summary.is-updated {
  animation: billing-summary-pulse 1100ms ease;
}
.billing-checkout-summary.is-updated .billing-summary-mark {
  animation: billing-mark-slide 1100ms ease;
}
@keyframes billing-summary-pulse {
  0% {
    border-color: var(--signal);
    background: color-mix(in srgb, var(--amber-soft) 72%, var(--surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 24%, transparent);
  }
  100% {
    border-color: rgba(40, 113, 83, 0.22);
    background: rgba(232, 247, 239, 0.58);
    box-shadow: 0 0 0 0 transparent;
  }
}
@keyframes billing-mark-slide {
  0% { transform: translateX(-6px); color: var(--signal); }
  60% { transform: translateX(2px); color: var(--signal); }
  100% { transform: translateX(0); }
}

/* API key rows and the connect-for-agent strip share the key motif. */
/* The create flow belongs in the card body as a full-width disclosure: the
   summary is a secondary expander (bordered, not a dark CTA), and the real
   submit inside stays the single primary action. The old parity layout parked
   a dark same-labelled button in the hero corner, which read as two competing
   "Create API key" CTAs. */
/* Secret reveal: the copy control sits inline with the secret value it
   copies (token-field pattern) instead of floating in the box header, and
   uses ghost-action so the card keeps a single dark primary. */
/* Inside the card the strip reads as a full-width row aligned with the key
   list, not a floating centered pill. The mount carries both classes. */
/* Inside the account card the strip's copy action is supporting, not a
   second primary — bordered ghost style keeps Create API key as the only
   dark CTA. Scoped to this mount so docs strips keep the ink button. */

@media (prefers-reduced-motion: reduce) {
  :is(.surface-dialog, .auth-gate-dialog)[open], .surface-dialog::backdrop { animation: none; }
  :is(.site-header, .auth-card, .feedback-panel, .result-panel) :is(a, button, input, textarea) { transition: none; }
  .billing-checkout-summary.is-updated { animation: none; }
}

/* R24 · Plan options read as comparable cards (name / price / quota / real
   capacity) instead of bare text rows — the Stripe/Linear picker pattern in
   our tokens. Cards keep .billing-segmented-option for radio semantics; the
   rules below only reshape layout + the selected treatment. */
/* Selected card still points at the review panel — the left→right cue lives
   in the card corner instead of trailing the row text. */
/* ── R25 · 选套餐单列纵贯：上方直选卡片、下方下单条（Stripe/Linear/Notion
   billing 的主流模式），不再左侧选右侧结账。 */

/* 卡片栏放宽：单列空间下订阅 2 卡、充值 3 卡都能完整并排 */

/* R25 · 呼吸感：reader 大纲不再贴死 header（tab 条已在 R27 改静态）。 */
body[data-brand-page="markdown-reader"] .reader-outline-inner {
  top: calc(96px + var(--preview-bar-height, 0px));
  max-height: calc(100vh - 114px - var(--preview-bar-height, 0px));
}

/* R25 · Job 行动作分层：Open in Reader 是唯一深色主动作；Download 降为
   轻量描边次级 + 下载图标，不再一排大黑块。 */

/* R25 · AI agent 条从 key 列表附属升级为独立板块——上下留白 + 小标题 +
   独立边框，与 key 区和连接设置区明显区隔。 */

/* ── R26 · 轻强调统一：选中分段不再实心黑，黑只留给 checkout 大 CTA。 */

/* Toggles 挪到卡片上方一行，主要区域全部留给 plan 卡。 */

/* Billing 区内选中态 = 轻强调（ink 描边 + 柔底），不再实心黑块。 */

/* 下单条：checkout 按钮变大，summary 安静，管理行降级为脚注。 */

/* Plan 卡可读性：名称/价格加大，辅助行分层更清楚。 */

/* 轻强调范式：job 行三个动作、View plans、Create/Delete API key 统一为
   描边轻按钮——页面只有一个深色主动作（checkout）。 */

/* 轻强调范式统一：所有 ghost-action 与 job 次级按钮同一边框深度，避免
   API keys / Sign out / Manage billing 各自深浅不一。 */

/* ── R27 · 平面化 + 静态导航 + checkout 并入选套餐块 + Plans 减枝 ── */

/* 按钮全平面：job 行、ghost、分段选中态全部去阴影，与 More 同平面。 */

/* 四 tab 固定在页面顶部（不跟随滚动），上下等间距——margin-bottom
   对齐页面自带 padding-top，视觉上下对称。 */

/* checkout 行并入 builder 卡：上边框分隔 = 选完即下单，同一视觉单元。 */

/* 下半区降级：management / current plan 是独立安静块，不再是下单卡片。 */

/* Plans 减枝：选中项不再带 → 尾巴；摘要脉冲动效（红→绿）关闭；
   摘要条去绿色调、去圆形箭头图标，回到安静的中性 surface；
   toggle 标签降级为小字。 */
.billing-checkout-summary.is-updated,
.billing-checkout-summary.is-updated .billing-summary-mark {
  animation: none;
}

/* Connect an AI Agent 独立板块：与上下卡片等距、自有边框标题。 */

/* Current plan 卡：renews 信息与 View plans 同一行，日期细微强调。 */

/* ── R28 · 细节质感：hidden 兜底 / 触控优化 / 数字等宽 ── */

/* 红线 #8 页面级兜底：任何 display 规则都不许复活 hidden 元素。 */

/* 触控质量：双击不触发缩放延迟，点按无默认高亮。 */

/* 数字排版：价格/容量/额度数字列等宽，月年切换不抖动。 */
.billing-checkout-summary strong {
  font-variant-numeric: tabular-nums;
}

/* ── R29 · 结算 CTA 独立样式 + job 行对齐/状态图标 + plan 卡布局 ── */

/* 专用结算按钮：terracotta 实心（品牌 accent），不是黑色也不是浅色描边——
   账户 checkout 与 pricing 页 plan-action 共用同一范式。
   需 #brand-site ID 前缀压过 brand.css 的墨色 plan-action 规则；
   .secondary（Contact us 等）保持安静描边，不吃实心色。 */
/* 次级购买入口（Contact us）：accent 描边安静变体，与实心 CTA 同族不同权重。 */
/* checkout 行：删摘要重复信息后回到一整条横条，去掉与选卡区之间的分隔线。 */

/* Current plan 卡：左侧信息列、View plans 右侧垂直居中（稍大按钮）。 */

/* Account 头部 API keys：升级为带 key 图标的轻按钮（图标用品牌成功色点题）。 */

/* Job 行三按钮严格同高同基线：More(summary) 与两个按钮同一几何。 */

/* Job 状态改图标优先：✓ 完成、转圈=进行中、✕ 失败、⊘ 已删、! 需注意。 */
@keyframes job-status-spin {
  to { transform: rotate(360deg); }
}

/* ── R30 · pricing v3 卡片样式共享化 + 头部按钮统一 + job 行对齐 + icon-only 状态 ── */

/* pricing v3 卡片：demo 与正牌 pricing 页共用（.pricing-page 作用域）。
   tagline 入名下方、Credits 大数字 hero、SVG 容量行、量化升级徽标。 */
/* page-polish 给首行加过 lead 盒式样式（border-block+大 padding），
   v3 卡片首行是普通特性行——提权清除，恢复行间距。 */
/* interval toggle：Annual · 2 months free 不换行、白丸不错位。 */
/* 头部动作与 View plans 统一：同字号同字重同高，不再一个 16px 一个 14px。 */

/* Job 行：三按钮不换行、严格同高同基线（details 容器对齐到行高）。 */

/* 状态 pill 图标化：只显示图标，文字走 aria-label。 */

/* API key 命名输入：与创建流同排，样式贴近其他表单项。 */

/* pricing 页 [hidden] 兜底（plan-save 的 data-annual-only 切换依赖）；
   rate-callout 原 demo 样式并入共享（正牌页同构）。 */
body[data-pricing-page] [hidden] { display: none !important; }
/* job 行链接带 .doc-link 的 margin-top:8px——flex 居中时被推低 4px，清零。 */

/* ── R31 · 跨页一致性审计收口 ─────────────────────────────────────────────
   hidden 语义全局兜底 + 头部控件同高 + job summary 字号对齐按钮。 */
body[data-brand-ui] [hidden] { display: none !important; }
body#brand-site[data-brand-ui] .site-header .header-actions > :is(a, button, details, .header-account-menu) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
body#brand-site[data-brand-ui] .site-header .header-actions > details > summary,
body#brand-site[data-brand-ui] .site-header .header-actions > .header-account-menu > .account-link {
  min-height: 44px;
  padding-block: 4px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

/* ── R32 · pricing 压缩 + 状态圆点 + key 弹窗 + plans 卡继承 ────────────────
   用户反馈收口：一屏完成下单、状态图标化、Plans 继承 pricing 卡视觉。 */

/* pricing 纵向压缩：一屏看完三张卡并完成下单。 */
/* plan-save 徽标与 rate 文案同一行：与 meta 同排展示。 */
/* Plans 页卡继承 pricing 视觉：白卡+圆角+阴影+terracotta 选中。 */
/* 状态圆点范式：Active 等非列表状态用绿点，不走文字 pill。 */

/* API key 行：压缩上下间距（原来留白过大）。 */

/* key 命名弹窗：与 remove-dialog 同范式。 */

/* R32b · 再压缩：容量行横向、特性行收紧，CTA 进一屏。 */
/* R32c · features 列表 gap 与巨号价格是压缩大头。 */
/* R32d · .table-list 作用域补齐后，符号 content 需同级提权回来。 */

/* ── R33 · 徽标缩小 + 价格块收正 + nav 压缩 + 状态着色 + Plans 复用 pricing 卡 ── */

/* 徽标：brand.css 把 .plan-badge 顶成 14px/31px——压回小尺寸。 */
/* 价格块收正：<p> 自带 44.84px 字号撑高，强制单行基线。 */
/* account 四 tab：下方 46px 空隙压缩。 */

/* 状态图形直出：去圆底，只留状态图标本身（✓/转圈/⊘），背景透明。 */

/* Plans 卡直接复用 pricing 卡视觉（同名类结构，单一视觉源）。 */

/* R36 · Plans 详情跳转升级为描边 pill——文本链接在卡片行里存在感太弱，
   用户需要一眼看到"可以去 pricing 看详情"的入口。 */

/* R36 · 选择态/估算态的退出 affordance——操作面板不能只给前向动作。 */

/* R37 · pricing 底部费率表——把密不透风的长段说明换成可扫读的三列表，
   结构沿用 demo 已验证的 rate-table（正牌页转正）。 */
.pricing-page .rate-table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 0.88rem;
  background: var(--surface, #fffdf8);
  border: 1px solid var(--line-strong, #d8cbb8);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.pricing-page .rate-table th {
  font: 700 0.68rem/1 var(--sans, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6b635a);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line, #e4dfd2);
}
.pricing-page .rate-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #e4dfd2);
  vertical-align: top;
}
.pricing-page .rate-table tbody tr:last-child td { border-bottom: 0; }
.pricing-page .rate-table td b { color: var(--ink); }
.pricing-page .rate-table td:last-child { color: var(--muted, #6b635a); font-size: 0.82rem; }

/* Overflow menu for secondary result actions (button[aria-expanded] +
   positioned panel — never <details>, which the SEO extractor reads as
   FAQ). */
.result-actions-menu {
  position: relative;
  display: inline-flex;
}
.result-actions-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line, #e4dfd2);
  background: var(--surface, #fff);
  color: var(--ink, #26221c);
  cursor: pointer;
}
.result-actions-menu-toggle:hover {
  background: color-mix(in oklab, currentColor 5%, var(--surface, #fff));
}
.result-actions-menu-toggle[aria-expanded="true"] {
  border-color: var(--accent, #b45f2f);
  color: var(--accent, #b45f2f);
}
.result-actions-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line, #e4dfd2);
  border-radius: var(--r-lg);
  background: var(--surface, #fff);
  box-shadow: 0 10px 32px rgba(38, 34, 28, 0.14);
}
.result-actions-menu-panel[hidden] {
  display: none;
}
.result-actions-menu-panel .result-actions-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--ink, #26221c);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.result-actions-menu-panel .result-actions-menu-item:hover {
  background: color-mix(in oklab, currentColor 6%, transparent);
}

/* Checkout CTA busy state — only feedback between the click and the /app veil */
@keyframes checkout-cta-spin {
  to {
    transform: rotate(1turn);
  }
}

/* Checkout handoff veil — masks the plan UI between a pricing CTA and Creem */
html[data-checkout-handoff] body {
  overflow: hidden;
}
html[data-checkout-handoff] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  /* styles.css gives body::before a grain mask that fades out — without the
     reset the veil would wash out and leak content in the lower viewport. */
  mask-image: none;
  background: var(--paper, #f6f0e5);
}
html[data-checkout-handoff] body::after {
  content: "Preparing secure checkout…";
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9999;
  max-width: min(340px, calc(100vw - 48px));
  padding: 16px 20px;
  border: 1px solid var(--line-strong, #bfae98);
  border-radius: var(--r-lg);
  color: var(--ink, #2a2118);
  background: var(--surface, #fffdf8);
  box-shadow: 0 16px 40px rgba(45, 32, 20, 0.16);
  font: 600 1.05rem/1.4 var(--sans, system-ui, sans-serif);
  letter-spacing: 0.01em;
  text-align: center;
  transform: translate(-50%, -50%);
}
html[data-checkout-handoff="slow"] body::after {
  content: "Still preparing secure checkout — this is taking longer than usual…";
}
@media (prefers-reduced-motion: no-preference) {
  html[data-checkout-handoff] body::after {
    animation: checkout-handoff-pulse 1.2s ease-in-out infinite;
  }
}
@keyframes checkout-handoff-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* Task inbox: search + expired state + compact one-row actions */
.task-inbox-search {
  display: block;
  padding: 0 20px 10px;
}
.task-inbox-search input {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong, #d8cdb8);
  border-radius: var(--r-md);
  background: var(--surface, #fffdf7);
  color: var(--ink, #2a2118);
  font: 500 0.85rem/1.3 inherit;
}
.task-inbox-search input:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.task-inbox-item[data-status="expired"] {
  opacity: 0.72;
}
.task-inbox-item[data-status="expired"] .task-status-marker {
  background: var(--muted, #8a8175);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--muted, #8a8175) 18%, transparent);
}
.task-inbox-item[data-status="expired"] .task-inbox-copy strong {
  color: var(--muted, #8a8175);
}
.task-inbox-actions .result-actions-menu {
  position: relative;
  display: inline-flex;
}
.task-inbox-actions .result-actions-menu-toggle {
  min-width: 44px;
  padding: 8px 12px;
}
.task-inbox-actions .result-actions-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-strong, #d8cdb8);
  border-radius: 10px;
  background: var(--surface, #fffdf7);
  box-shadow: 0 12px 32px rgba(42, 33, 24, 0.18);
}
.task-inbox-actions .result-actions-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--ink, #2a2118);
  font: 600 0.82rem/1.2 inherit;
  text-decoration: none;
  white-space: nowrap;
}
.task-inbox-actions .result-actions-menu-item:hover {
  background: var(--paper, #f4ecdd);
}
.task-inbox-actions .result-actions-menu-item:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--signal);
}
.task-inbox-actions .result-actions-menu-item svg {
  flex: none;
}

/* ── State-component polish: sync line, skeletons, micro-interactions ── */

/* Account sync line — the one always-visible status row on the dashboard.
   The hidden auth-screen status element stays for form errors; this line
   carries refresh state so an account refresh is never silent. */
@keyframes sync-dot-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

/* ── Skeleton — one placeholder component for every async panel. ──
   Base: .skeleton paints the warm bar fill; .skeleton-bar stays as the
   legacy alias used by existing markup. Size modifiers set geometry only:
   .skeleton-line (text line), .skeleton-metric (number), .skeleton-row
   (list-row slot wrapping a bar), .skeleton-sheet (reader page shape).
   The docs connection-panel family (.sk-block, .skeleton-tag/-heading/
   -decision/-steps/-tabs/-copy/-pre) is scoped in parity-review.css.
   Motion: shimmer under no-preference, static fill under reduced motion. */
.skeleton,
.skeleton-bar {
  display: inline-block;
  border-radius: 5px;
  background: var(--line, #ddd0bd);
  vertical-align: middle;
}
.skeleton-line {
  width: 68%;
  height: 0.72em;
}
.skeleton-metric {
  width: 5.2em;
  height: 1em;
}
.skeleton-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
}
.skeleton-row :is(.skeleton, .skeleton-bar) {
  width: 72%;
  height: 0.78em;
}
.skeleton-sheet {
  width: min(520px, 88%);
  height: 320px;
  border-radius: var(--r-md);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton,
  .skeleton-bar {
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
  }
}
@keyframes skeleton-shimmer {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.42;
  }
}

/* Text swap — a short out/in cross-fade for status copy that changes under
   the user's eyes (stage labels, reconnect notices). No-op under reduced
   motion because the helper writes textContent directly. */

/* Value bump — brief highlight when a balance number finishes counting up. */
.value-bumped {
  animation: value-bump 650ms ease-out;
}
@keyframes value-bump {
  0% {
    color: var(--blue, #e65322);
  }
  100% {
    color: inherit;
  }
}

/* Shake — one-shot attention nudge on hard errors (auth failure, dropped
   unsupported file). Never loops; suppressed under reduced motion. */
.shake-once {
  animation: shake-once 340ms ease-in-out;
}
@keyframes shake-once {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  45% {
    transform: translateX(4px);
  }
  70% {
    transform: translateX(-3px);
  }
  88% {
    transform: translateX(2px);
  }
}

/* Toast exit — mirrored entrance so evicted/dismissed toasts leave the
   stack instead of popping. */
.task-toast.is-exiting {
  animation: task-toast-out 190ms ease-in both;
}
@keyframes task-toast-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

/* Conversion stage summary extras — status copy + elapsed clock sit on the
   right side of the summary row. */

/* Reader pane skeleton — a page-shaped shimmer while pdf.js draws. */
.reader-pane-loading {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 24px 0;
}

/* Reconnecting poll state — amber status while the row waits out a
   transient fetch failure; cleared by the next successful poll. */

/* Per-page progress — the meter slot owns a full line at a fixed height
   so a determinate bar appearing mid-run never reflows the row. */
/* Below 640px the shared stylesheet turns rows into display:grid with an
   auto column — an item's width:100%/stretch then resolves against the
   content-sized track and the meter collapses to the bar's intrinsic
   width. Pin the single column to the row's content box. */

/* Upload options — the secondary Pages control stays behind a disclosure
   so the primary Convert action keeps its place. */

/* Focus ring — the unified token ring. These rules moved out of the
   production-frozen styles.css; they load later and win the cascade, so the
   rendered ring is identical. */
:where(
  a,
  button,
  input,
  select,
  textarea,
  summary,
  [tabindex],
  [role="button"],
  [role="tab"],
  [role="switch"],
  [role="link"],
  [role="menuitem"],
  [role="option"],
  [contenteditable="true"]
):focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.url-field input[type="url"]:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.proof-tabs button:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.hero-disclosure-toggle:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Unified dialog motion — every modal surface (native <dialog>, the
   .redeem-dialog overlay, anchored .admin-quick-popover confirms) enters with
   the same fade + short rise and exits with a quicker fade + drop. Exit plays
   via .is-closing, which animateDialogClose() in dom-utils.js toggles before
   the real close so the motion is visible. The keyframes override the legacy
   translateX surface-dialog-in kept in the frozen sheet. */
:is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog)[open],
.redeem-dialog:not([hidden]) .redeem-card,
.admin-quick-popover {
  animation: surface-dialog-in var(--dur-3) var(--ease-enter) both;
}
:is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog)[open]::backdrop,
.redeem-dialog:not([hidden]) {
  animation: surface-backdrop-in var(--dur-2) var(--ease-standard) both;
}
:is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog, .admin-quick-popover).is-closing,
.redeem-dialog.is-closing .redeem-card {
  animation: surface-dialog-out var(--dur-2) var(--ease-exit) both;
}
:is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog).is-closing::backdrop,
.redeem-dialog.is-closing {
  animation: surface-backdrop-out var(--dur-2) var(--ease-exit) both;
}

@keyframes surface-dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes surface-dialog-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes surface-backdrop-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog)[open],
  .redeem-dialog:not([hidden]),
  .redeem-dialog:not([hidden]) .redeem-card,
  .admin-quick-popover,
  .is-closing,
  :is(.surface-dialog, .auth-gate-dialog, .proof-example-dialog)::backdrop {
    animation: none;
  }
}

/* Busy buttons — setButtonBusy() in dom-utils.js swaps the label for a
   .busy-spinner svg and sets aria-busy + .is-busy. The ::after suppression
   keeps the legacy .social-button[aria-busy] spinner in styles.css from
   doubling up on buttons that now carry the inline spinner. */
button.is-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.is-busy .busy-spinner {
  animation: markovo-spin 0.9s linear infinite;
}

.social-button[aria-busy="true"].is-busy::after {
  content: none;
}

@media (prefers-reduced-motion: reduce) {
  .is-busy .busy-spinner {
    animation: none;
  }
}

/* Scrollable tab strips — initScrollableTabs() adds .scrollable-tabs and
   toggles is-scroll-start / is-scroll-end so each edge fades only while it
   still hides items. Desktop is unchanged: no overflow means no classes. */
.scrollable-tabs {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.scrollable-tabs::-webkit-scrollbar {
  display: none;
}
.scrollable-tabs.is-scroll-start {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px);
  mask-image: linear-gradient(90deg, transparent, #000 24px);
}
.scrollable-tabs.is-scroll-end {
  -webkit-mask-image: linear-gradient(270deg, transparent, #000 24px);
  mask-image: linear-gradient(270deg, transparent, #000 24px);
}
.scrollable-tabs.is-scroll-start.is-scroll-end {
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 24px,
    #000 calc(100% - 24px),
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 24px,
    #000 calc(100% - 24px),
    transparent
  );
}
