/* The green workspace palette, scoped to the selected public surfaces. */
body[data-green-surface] {
  color-scheme: dark;
  --gh-bg: #0a100d;
  --gh-surface: #101914;
  --gh-raised: #152019;
  --gh-input: #0e1711;
  --gh-line: #2c4033;
  --gh-strong-line: #496955;
  --gh-ink: #eff6f0;
  --gh-muted: #afc0b2;
  --gh-green: #a3efba;
  --gh-deep: #102319;
  --gh-soft: #1d3427;
  --gh-warn: #f0c68c;
  --gh-error: #ffb0a5;
  --ec-ink: var(--gh-ink);
  --ec-muted: var(--gh-muted);
  --ec-green: var(--gh-green);
  --ec-green-hover: #c2fbd1;
  --ec-paper: var(--gh-bg);
  --ec-white: var(--gh-surface);
  --ec-line: var(--gh-line);
  --ec-soft: var(--gh-soft);
  --ec-accent: var(--gh-warn);
  --ec-warn: #2e251a;
  --desk-ink: var(--gh-ink);
  --desk-paper: var(--gh-bg);
  --desk-panel: var(--gh-surface);
  --desk-rule: var(--gh-line);
  --desk-muted: var(--gh-muted);
  --pq-ink: var(--gh-ink);
  --pq-paper: var(--gh-bg);
  --pq-panel: var(--gh-surface);
  --pq-line: var(--gh-line);
  --pq-violet: var(--gh-green);
  --pq-lilac: var(--gh-soft);
  --pq-nav: var(--gh-bg);
  --pq-nav-text: var(--gh-ink);
  --pq-nav-action: var(--gh-green);
  --j-ink: var(--gh-ink);
  --j-muted: var(--gh-muted);
  --j-paper: var(--gh-bg);
  --j-line: var(--gh-line);
  --j-purple: var(--gh-green);
  --j-lime: var(--gh-soft);
  --quiet-ink: var(--gh-ink);
  --quiet-muted: var(--gh-muted);
  --quiet-paper: var(--gh-bg);
  --quiet-green: var(--gh-green);
  --quiet-rule: var(--gh-line);
  --market-dark: var(--gh-ink);
  --market-violet: var(--gh-green);
  --market-panel: var(--gh-surface);
  --market-border: var(--gh-line);
  --fin-ink: var(--gh-ink);
  --fin-muted: var(--gh-muted);
  --fin-brand: var(--gh-green);
  --fin-line: var(--gh-line);
  --fin-bg: var(--gh-bg);
  --fin-paper: var(--gh-surface);
  --fin-positive: var(--gh-green);
  --fin-negative: var(--gh-error);
  --ink: var(--gh-ink);
  --muted: var(--gh-muted);
  --paper: var(--gh-bg);
  --surface: var(--gh-surface);
  --line: var(--gh-line);
  --green: var(--gh-green);
  --purple: var(--gh-green);
  --lime: var(--gh-green);
  background: var(--gh-bg);
  color: var(--gh-ink);
}

body[data-green-surface] :is(a, button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--gh-green);
  outline-offset: 3px;
}

/* Keep all existing navigation and make its frame match the home page. */
body[data-green-surface] :is(.fin-header, .j-header, #app > .header, .ecosystem-topbar) {
  margin-top: 0;
  background: var(--gh-bg);
  border-bottom: 1px solid var(--gh-line);
}
body[data-green-surface] :is(.fin-header .fin-head-row, .j-header .j-nav, #app > .header .header-inner) {
  margin-top: 0;
  min-height: 63px;
  background: var(--gh-bg);
  border-radius: 0;
  color: var(--gh-ink);
}
body[data-green-surface] :is(.fin-mobile nav, .j-mobile-nav nav, .mobile-nav, .header-menu, .search-panel) {
  background-color: var(--gh-raised);
  border-color: var(--gh-line);
  color: var(--gh-ink);
}
body[data-green-surface] :is(.fin-brand, .j-brand, .brand, .fin-language, .lang-button, .j-search-link) { color: var(--gh-ink); }
body[data-green-surface] :is(.fin-nav a, .j-desktop a, .header-nav a) { color: var(--gh-muted); }
body[data-green-surface] :is(.fin-nav a, .j-desktop a, .header-nav a):is(:hover,[aria-current]) { color: var(--gh-green); }
body[data-green-surface] :is(.fin-editorial-hero, .fin-market-head, .home-hero, .j-top) { background: var(--gh-bg); border-color: var(--gh-line); }
body[data-green-surface] :is(.fin-editorial-hero, .fin-market-head, .home-hero, .hero, .tool-heading, .j-article-head) h1 {
  color: var(--gh-ink);
  font-weight: 640;
  letter-spacing: -.048em;
}
body[data-green-surface] :is(.fin-editorial-hero p, .fin-market-head p, .home-hero p, .hero p, .wallet-panel p, .tool-subtitle, .j-article-head > p, .j-card-body p) { color: var(--gh-muted); }
body[data-green-surface] :is(.fin-kicker, .j-kicker, .eyebrow, .fin-market-jumps, .fin-text-link, .text-link) { color: var(--gh-green); }
body[data-green-surface] :is(.fin-kicker, .j-kicker, .eyebrow)::before { background-color: var(--gh-strong-line); }
body[data-green-surface] :is(.fin-panel, .fin-section .fin-card, .j-card, .j-tool-card, .j-search-result, .j-toc, .j-search-form, .workbench, .tool-card, .editor, .amount-workbench, .guide-card, .reading-card, .ec-related-reading, .ec-schema-publisher) {
  background: var(--gh-surface);
  border-color: var(--gh-line);
  color: var(--gh-ink);
  box-shadow: none;
}
body[data-green-surface] :is(.fin-footer, .j-footer, footer.footer) { background: var(--gh-surface); border-color: var(--gh-line); color: var(--gh-ink); }
body[data-green-surface] :is(.fin-footer, .j-footer, footer.footer, .ec-related-reading, .ec-schema-publisher) :is(a,p,small) { color: var(--gh-muted); }
body[data-green-surface] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  color: var(--gh-ink);
  background: var(--gh-input);
  border-color: var(--gh-strong-line);
  caret-color: var(--gh-green);
}
body[data-green-surface] :is(input, textarea)::placeholder { color: #91a699; }
body[data-green-surface] :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--gh-green); }
body[data-green-surface] :is(.fin-button:not(.secondary), .j-button:not(.secondary), .run-button, .button:not(.secondary):not(.subtle), .primary-button) {
  color: var(--gh-deep) !important;
  background: var(--gh-green);
  border-color: var(--gh-green);
  border-radius: 7px;
}
body[data-green-surface] :is(.fin-button.secondary, .j-button.secondary, .button.secondary, .button.subtle, .plain-button, .search-trigger) {
  background: var(--gh-raised);
  color: var(--gh-ink) !important;
  border-color: var(--gh-strong-line);
  border-radius: 7px;
}
body[data-green-surface] :is(.fin-button, .j-button, .button, .plain-button):hover { filter: brightness(1.12); }

/* The table keeps its existing filters, horizontal scroll and status fields. */
body.fin-shell[data-green-surface="market"] { background: var(--gh-bg); }
body[data-green-surface="market"] :is(.fin-market-grid, .fin-scroll, #directory .fin-scroll, #compare .fin-scroll) { background: var(--gh-surface); border-color: var(--gh-line); }
body.desk-market[data-green-surface="market"] :is(#directory, #compare) .fin-scroll { background: var(--gh-surface); }
body.desk-market[data-green-surface="market"] :is(#directory, #compare) .fin-table tbody tr:nth-child(even) { background: var(--gh-input); }
body.desk-market[data-green-surface="market"] :is(#directory, #compare) .fin-table :is(thead th, tbody tr:hover) { background: var(--gh-raised); color: var(--gh-ink); }
body[data-green-surface="market"] .fin-table :is(td, th) { border-color: var(--gh-line); }
body.desk-market[data-green-surface="market"] #directory .fin-table tbody tr[data-fin-project-row] { background: var(--gh-soft); }
body.desk-market[data-green-surface="market"] #directory .fin-project-purchase { color: var(--gh-green); }
body.desk-market[data-green-surface="market"] :is(h2, h3) { color: var(--gh-ink); }
body.desk-market[data-green-surface="market"] :is(.fin-control, .fin-table .fin-quote-stamp) { color: var(--gh-muted); }
body[data-green-surface="market"] :is(.fin-quote-stamp, .fin-quote-badge, .fin-live, .fin-compare-source, .fin-quote-status, .fin-market-grid small) { color: var(--gh-muted); }
body.desk-market[data-green-surface="market"] :is(.fin-star, .fin-filter button) { background: var(--gh-raised); border-color: var(--gh-line); color: var(--gh-ink); }
body.desk-market[data-green-surface="market"] :is(.fin-star, .fin-filter button)[aria-pressed="true"] { background: var(--gh-green); border-color: var(--gh-green); color: var(--gh-deep); }
body[data-green-surface="market"] :is(.fin-up,.up,[data-quote-status="current"]) { color: var(--gh-green); }
body[data-green-surface="market"] :is(.fin-down,.down) { color: var(--gh-error); }
body[data-green-surface="market"] [data-quote-status="delayed"] { color: var(--gh-warn); }

/* Journal lists, articles and developer workspaces. */
body[data-green-surface] :is(.j-filters, .j-search-scope) button { color: var(--gh-muted); background: var(--gh-surface); border-color: var(--gh-line); }
body.j-page[data-green-surface] :is(.j-filters, .j-search-scope) button[aria-pressed="true"] { color: var(--gh-deep); background: var(--gh-green); border-color: var(--gh-green); }
body[data-green-surface] :is(.j-card-meta, .j-prose p, .j-prose li, .j-caption, .j-article-head .j-meta, .j-search-summary, .j-tool-note) { color: var(--gh-muted); }
body[data-green-surface] :is(.j-prose a, .j-toc a, .j-related a, .ec-news-card-source a) { color: var(--gh-green); }
body[data-green-surface] :is(.j-prose pre, .j-related, .j-promo .j-project-chain, .j-promo .j-project-security, .j-promo .j-project-tools, .j-tool-note, .home-hero .hero-art, .tool-icon, .tool-heading .pill, .promo) { background: var(--gh-raised); border-color: var(--gh-line); color: var(--gh-ink); }
body[data-green-surface] :is(.j-promo p, .promo p, .promo .promo-tag, .j-promo .j-kicker) { color: var(--gh-muted); }
body[data-green-surface] .j-promo .j-project-security p { color: var(--gh-muted); }
body[data-green-surface] :is(.j-top, .j-article-head) a { color: var(--gh-green); }
body.j-page[data-green-surface] :is(.j-links, .j-actions, .j-hero-links) a { color: var(--gh-green); }
body[data-green-surface="tools"] #app > .header .search-trigger { background: var(--gh-raised); border-color: var(--gh-strong-line); color: var(--gh-ink); }
body[data-green-surface="tools"] :is(.sidebar, .workbench-bar, .editor-label, .editor-foot, .run-bar, .hash-result, .hash-body, .file-drop, .amount-workbench, .floating-code, .art-result, .tool-grid .tool-card, .segmented, .output-empty, .editor-panel) { background: var(--gh-surface); border-color: var(--gh-line); color: var(--gh-ink); }
body[data-green-surface="tools"] :is(.sidebar-note, .sidebar-heading, .editor-label label, .editor-label small, .editor-foot span, #output-empty span, #output-empty small, #standard-output-actions > span, .tool-main .run-bar > span, .tool-main .context-note, .tool-main .breadcrumbs a, .tool-main .breadcrumbs span, .metrics-consent p) { color: var(--gh-muted); }
body[data-green-surface="tools"] :is(.sidebar a.active, .mobile-tools a.active, .segmented .active, .segmented [aria-pressed="true"]) { background: var(--gh-soft); color: var(--gh-green); }
body[data-green-surface="tools"] :is(.result-status, .metrics-consent, .tool-guide, .code-example, .takeaway, .trust-strip, .trust-item) { background: var(--gh-raised); border-color: var(--gh-line); color: var(--gh-muted); }
body[data-green-surface="tools"] :is(.output-editor, .resource-ribbon, .service-bridge, .abi-visual, .dialog, .search-results a) {
  background: var(--gh-raised);
  border-color: var(--gh-line);
  color: var(--gh-ink);
}
body[data-green-surface] :is(.skip-link, .fin-skip):focus { background: var(--gh-green); color: var(--gh-deep); }
body[data-green-surface="tools"] .metrics-consent button { background: var(--gh-input); color: var(--gh-ink); border-color: var(--gh-strong-line); }
body[data-green-surface="tools"] .metrics-consent .consent-yes { background: var(--gh-green); color: var(--gh-deep); }

/* Checkout keeps the wallet help, terms and quote states distinct. */
body[data-green-surface="checkout"] > header { margin-top: 0; border-radius: 0; border-bottom: 1px solid var(--gh-line); background: var(--gh-bg); }
body[data-green-surface="checkout"] .strip { background: var(--gh-raised); color: var(--gh-muted); }
body[data-green-surface="checkout"] :is(.hero-art, .wallet-panel, .panel, .participation-flow a, .position, .overview article, .wallet-help, .terms-list, .checkout-checklist li) { background: var(--gh-surface); color: var(--gh-ink); border-color: var(--gh-line); box-shadow: none; }
body[data-green-surface="checkout"] :is(.hero h1 em, .hero a[href="#participation"], .text-link, .checkout-checklist [data-ready="yes"], .feedback) { color: var(--gh-green); }
body[data-green-surface="checkout"] :is(.scope, #wallet-role:not(:empty), .warning) { background: #2b241a; color: var(--gh-warn); border-color: #6c5235; }
body[data-green-surface="checkout"] :is(.muted, .fine, .rules small, .quote small, .empty, .checkout-checklist small, label small) { color: var(--gh-muted); }
body[data-green-surface="checkout"] :is(.participation-flow small, .panel > p, .panel label, .step-detail, .orders-explainer, .airdrop-note) { color: var(--gh-muted); }
body[data-green-surface="checkout"] .participation-flow > a:hover { background: var(--gh-raised); border-color: var(--gh-green); }
body[data-green-surface="checkout"] :is(.feedback.error, .quote.error, .error) { color: var(--gh-error); }
body[data-green-surface="checkout"] :is(.tag, .pill, .participation-flow b:first-child) { background: var(--gh-soft); color: var(--gh-green); }
body[data-green-surface="checkout"] :is(.message, .receiver-purpose, .mainnet-airdrop, .preparation-summary, .live-status, .table-wrap, .table-wrap th, .checkout-checklist article) {
  background: var(--gh-raised);
  border-color: var(--gh-line);
  color: var(--gh-ink);
}
body[data-green-surface="checkout"] #live-terms .check-label { background: var(--gh-raised); border-color: var(--gh-strong-line); color: var(--gh-ink); }
body[data-green-surface="checkout"] #live-terms .check-label::after { color: var(--gh-muted); }
body[data-green-surface="checkout"] #live-terms .check-label:has(input:checked) { background: var(--gh-soft); border-color: var(--gh-green); }
body[data-green-surface="checkout"] #live-terms .check-label:has(input:checked)::before,
body[data-green-surface="checkout"] #live-terms .check-label:has(input:checked)::after { color: var(--gh-green); }
body[data-green-surface="checkout"] #live-terms .check-label input { accent-color: var(--gh-green); }
body[data-green-surface="checkout"] #checkout-purchase-form { border-color: var(--gh-strong-line); }

@media (max-width: 620px) {
  body[data-green-surface] :is(.fin-header .fin-head-row, .j-header .j-nav, #app > .header .header-inner) { min-height: 53px; }
  body[data-green-surface] :is(.fin-editorial-hero, .fin-market-head, .home-hero) h1 { font-size: clamp(30px, 8vw, 43px); }
}
