/*
 * Site-wide light/dark theme.
 *
 * Light mode lives in theme-2026.css. This file only overrides tokens and the
 * components that still carry a hard-coded light surface. Keep the paper/ink
 * relationship: paper is the page ground, surface is a raised card, ink is text.
 */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0d1210;
  --paper-deep: #151c17;
  --surface: #1b231e;
  --ink: #edf1ea;
  --ink-soft: #c3cec5;
  --muted: #98a69b;
  --line: #2d3830;
  --line-strong: #465449;
  --accent: #ff7052;
  --accent-dark: #ffab94;
  --accent-soft: #38251f;
  --highlight: #f3d36b;
  --success: #6ed3a6;
  --dash-surface: #1b231e;
  --dash-paper: #0d1210;
  --dash-line: #2d3830;
  --dash-line-soft: #263029;
  --dash-ink: #edf1ea;
  --dash-ink-soft: #c3cec5;
  --dash-muted: #98a69b;
  --dash-accent-soft: #38251f;
  --dash-accent-dark: #ffab94;
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] ::selection { background: var(--highlight); color: #121715; }
html[data-theme="dark"] .masthead { background: color-mix(in srgb, var(--paper) 94%, transparent); }
html[data-theme="dark"] .mega-menu { background: var(--surface); }
html[data-theme="dark"] .site-footer { background: #080c09; }
html[data-theme="dark"] .price-card-featured,
html[data-theme="dark"] .developer-hero,
html[data-theme="dark"] .hw-runbar { background: #080c09; color: #edf1ea; }
html[data-theme="dark"] .hero { background: #080c09; }
html[data-theme="dark"] .hero-highlight { color: #121715; }
html[data-theme="dark"] .primary,
html[data-theme="dark"] .account-nav,
html[data-theme="dark"] .tools-menu[open] > summary { border-color: var(--highlight); background: var(--highlight); color: #121715; }
html[data-theme="dark"] .primary:hover:not(:disabled),
html[data-theme="dark"] .account-nav:hover { border-color: #fff; background: #fff; color: #121715; }
html[data-theme="dark"] .secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .secondary-button:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .brand { color: var(--ink); }
html[data-theme="dark"] .nav-links a:hover,
html[data-theme="dark"] .nav-sections a:hover { color: var(--ink); }
html[data-theme="dark"] .masthead .nav { border-color: var(--line); }
html[data-theme="dark"] .tools-menu > summary,
html[data-theme="dark"] .recent-menu > summary { border-color: var(--line); background: var(--surface); color: var(--ink-soft); }
html[data-theme="dark"] .hero-tool-token-inner { background: rgba(8, 12, 9, .72); color: #eef2ea; }
html[data-theme="dark"] .hero-tool-token.is-paper .hero-tool-token-inner { background: rgba(27, 35, 30, .96); color: var(--ink); }
html[data-theme="dark"] .hero-tool-token.is-accent .hero-tool-token-inner { background: var(--highlight); color: #121715; }
html[data-theme="dark"] .hero-tool-token.is-hovered .hero-tool-token-inner { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .hero-tool-token.is-paper.is-hovered .hero-tool-token-inner,
html[data-theme="dark"] .hero-tool-token.is-accent.is-hovered .hero-tool-token-inner { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .intake-foot { background: var(--paper-deep); }
html[data-theme="dark"] body[data-home-tools] .hero-upload-dropzone { background: var(--surface); }
html[data-theme="dark"] body[data-home-tools] .hero-upload-dropzone.is-dragging,
html[data-theme="dark"] body[data-home-tools] .hero-upload-dropzone:focus-within { background: var(--accent-soft); }
html[data-theme="dark"] .intake-stack span { background: var(--paper-deep); }
html[data-theme="dark"] .catalog-nav a:hover { background: var(--highlight); border-color: var(--highlight); color: #121715; }
html[data-theme="dark"] .tool-card:hover,
html[data-theme="dark"] .tool-card:focus-visible { box-shadow: 0 16px 34px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .tool-card:nth-child(4n + 1) .tool-mark { background: linear-gradient(145deg, #4a2a22, #3a211c); color: #ffb3a2; }
html[data-theme="dark"] .tool-card:nth-child(4n + 2) .tool-mark { background: linear-gradient(145deg, #1e3b2b, #183323); color: #8fe0b7; }
html[data-theme="dark"] .tool-card:nth-child(4n + 3) .tool-mark { background: linear-gradient(145deg, #40381f, #342d18); color: #f0d58a; }
html[data-theme="dark"] .tool-card:nth-child(4n) .tool-mark { background: linear-gradient(145deg, #1e3245, #192b3b); color: #a9cdec; }
html[data-theme="dark"] .file-stage .drop-zone.dragging,
html[data-theme="dark"] .file-stage .drop-zone:focus-within { background: var(--accent-soft); }
html[data-theme="dark"] .result-mark { background: #183326; }
html[data-theme="dark"] .api-beta-notice { border-color: #6b5324; border-left-color: var(--highlight); background: #211b0d; }
html[data-theme="dark"] .developer-section pre,
html[data-theme="dark"] .sdk-card pre { background: #080c09; }
html[data-theme="dark"] .api-table-wrap th { color: var(--ink-soft); }
html[data-theme="dark"] .api-operation,
html[data-theme="dark"] .sdk-card,
html[data-theme="dark"] .developer-keys { border-color: var(--line); background: var(--surface); }
html[data-theme="dark"] .developer-keys-create input,
html[data-theme="dark"] .developer-key-rename input,
html[data-theme="dark"] .developer-key-secret code,
html[data-theme="dark"] .developer-key-actions button { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .developer-key-secret { border-color: var(--accent); background: var(--accent-soft); }
html[data-theme="dark"] .developer-key-row { background: var(--paper-deep); }
html[data-theme="dark"] .developer-hero > p { color: var(--ink-soft); }
html[data-theme="dark"] .developer-hero .button.primary { border-color: var(--highlight); background: var(--highlight); color: #121715; }
html[data-theme="dark"] .tool-intro h1 .tool-mark,
html[data-theme="dark"] .image-tool-heading h1 .tool-mark,
html[data-theme="dark"] .pdf-editor-heading h1 .tool-mark { background: var(--paper-deep) !important; color: var(--highlight) !important; }
html[data-theme="dark"] .cookie-banner,
html[data-theme="dark"] .cookie-dialog { border-color: var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
html[data-theme="dark"] .cookie-option { border-color: var(--line); background: var(--paper-deep); }
html[data-theme="dark"] .cookie-banner-copy strong { color: var(--ink); }

/* Dashboard: keep the ink sidebar, darken the desk and raised panels. */
html[data-theme="dark"] .dashboard-page { background: var(--dash-paper); }
html[data-theme="dark"] .dashboard-sidebar { background: #080c09; }
html[data-theme="dark"] .dashboard-topbar { background: color-mix(in srgb, var(--dash-paper) 92%, transparent); border-color: var(--dash-line); }
html[data-theme="dark"] .dashboard-menu-toggle,
html[data-theme="dark"] .dashboard-icon-link { background: var(--dash-surface); border-color: var(--dash-line); color: var(--dash-ink-soft); }
html[data-theme="dark"] .dashboard-icon-link:hover { border-color: var(--dash-ink); color: var(--dash-ink); }
html[data-theme="dark"] .kpi-storage { background: linear-gradient(160deg, var(--dash-surface) 35%, #2a1d18); border-color: #4a3028; }
html[data-theme="dark"] .kpi progress,
html[data-theme="dark"] .kpi progress::-webkit-progress-bar { background: #263029; }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .settings-grid .panel { background: var(--dash-surface); border-color: var(--dash-line); }
html[data-theme="dark"] .passkey-row { background: var(--paper-deep); }
html[data-theme="dark"] .passkey-form-row input,
html[data-theme="dark"] .delete-account-form input:not([type="checkbox"]),
html[data-theme="dark"] .panel input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .panel textarea,
html[data-theme="dark"] .panel select { background: var(--paper-deep); color: var(--dash-ink); border-color: var(--dash-line); }
html[data-theme="dark"] .delete-account-dialog { background: var(--dash-surface); border-color: var(--dash-line); color: var(--dash-ink); }
html[data-theme="dark"] .danger-button { border-color: #ff6b62; background: #b42318; color: #fff; }
html[data-theme="dark"] .files-table th,
html[data-theme="dark"] .files-table td { border-color: var(--dash-line); }
html[data-theme="dark"] .files-table thead th { color: var(--dash-muted); }
html[data-theme="dark"] .files-table tbody > tr > th[scope="row"] { background: transparent; }

/* Toggle */
.theme-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { border-color: var(--ink); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
.dashboard-topbar-actions .theme-toggle { border-color: var(--dash-line); background: var(--dash-surface); color: var(--dash-ink-soft); }
.auth-top .theme-toggle { order: 1; margin-left: auto; }
.auth-top .auth-top-link { order: 2; }

@media (max-width: 760px) {
  .nav-links .theme-toggle { width: 34px; height: 34px; }
}

html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .auth-provider-button { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .auth-provider-button:hover,
html[data-theme="dark"] .auth-provider-button:focus-visible { border-color: var(--ink); background: var(--surface); }
html[data-theme="dark"] .auth-provider-mark { background: var(--surface); color: var(--ink-soft); }
html[data-theme="dark"] .auth-benefit-icon { border-color: var(--line); background: var(--surface); }

/* PDF editor and PDF Forms chrome. The page canvas stays white on purpose. */
html[data-theme="dark"] .editor-topbar,
html[data-theme="dark"] .editor-tools,
html[data-theme="dark"] .editor-pages,
html[data-theme="dark"] .editor-page-nav,
html[data-theme="dark"] .editor-context-slot { border-color: var(--line); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .editor-canvas-scroll { background: #0b100d; }
html[data-theme="dark"] .editor-document-name { color: var(--ink); }
html[data-theme="dark"] .editor-history-actions button,
html[data-theme="dark"] .editor-page-nav button,
html[data-theme="dark"] .editor-page-thumb-actions button,
html[data-theme="dark"] .editor-page-actions button,
html[data-theme="dark"] .editor-context-toolbar button,
html[data-theme="dark"] .editor-context-toolbar select,
html[data-theme="dark"] .editor-context-toolbar input,
html[data-theme="dark"] .editor-sidebar-trigger { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .editor-page-thumb,
html[data-theme="dark"] .editor-page-item { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .pdf-forms-mode-tabs { border-color: var(--line); background: var(--surface); }
html[data-theme="dark"] .pdf-forms-mode[aria-pressed="true"] { border-color: var(--highlight); background: var(--highlight); color: #121715; }
html[data-theme="dark"] .pdf-forms-mode[aria-pressed="true"] small { color: #5c4a16; }
html[data-theme="dark"] .pdf-forms-library-search input,
html[data-theme="dark"] .pdf-forms-detect-controls input,
html[data-theme="dark"] .pdf-forms-detect-controls select { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .pdf-forms-library-card:hover,
html[data-theme="dark"] .pdf-forms-library-card:focus-visible { background: var(--surface); }
html[data-theme="dark"] .pdf-forms-fields-count { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }

/* Trust center and legal surfaces. */
html[data-theme="dark"] .security-jump a,
html[data-theme="dark"] .security-grid article,
html[data-theme="dark"] .security-table-wrap,
html[data-theme="dark"] .security-faq details,
html[data-theme="dark"] .security-report { border-color: var(--line); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .security-table thead th { background: var(--paper-deep); }
html[data-theme="dark"] .security-report { background: linear-gradient(160deg, var(--surface) 45%, #2a1d18); }
html[data-theme="dark"] .status-badge.is-review { background: #3b3014; color: #f3d36b; }
html[data-theme="dark"] .status-badge.is-none { background: var(--paper-deep); color: var(--muted); }
html[data-theme="dark"] .status-badge.is-certified { background: #163527; color: #8fe0b7; }
html[data-theme="dark"] .privacy-request-form input:not([type="checkbox"]),
html[data-theme="dark"] .privacy-request-form select,
html[data-theme="dark"] .privacy-request-form textarea { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .privacy-reference { border-color: var(--line); background: #163527; }
html[data-theme="dark"] .library-heading-note { background: #080c09; color: #edf1ea; }
html[data-theme="dark"] .forms-hero-note { background: #080c09; color: #edf1ea; }
html[data-theme="dark"] .compare-hero-note,
html[data-theme="dark"] .pdf-forms-processing,
html[data-theme="dark"] .tool-processing-mini { background: #080c09; color: #edf1ea; }
html[data-theme="dark"] .catalog-nav a:hover,
html[data-theme="dark"] .forms-filter[aria-pressed="true"] { border-color: var(--highlight); background: var(--highlight); color: #121715; }
html[data-theme="dark"] .form-card-preview::after { background: #080c09; color: #edf1ea; }
html[data-theme="dark"] .forms-guide li::before { background: var(--highlight); color: #121715; }
html[data-theme="dark"] .editor-forms-done { border-color: var(--highlight) !important; background: var(--highlight) !important; color: #121715 !important; }
html[data-theme="dark"] .workflow-status { background: var(--paper-deep); color: var(--ink-soft); }
html[data-theme="dark"] .workflow-template,
html[data-theme="dark"] .workflow-tool,
html[data-theme="dark"] .workflow-library-item,
html[data-theme="dark"] .workflow-node,
html[data-theme="dark"] .workflow-search input,
html[data-theme="dark"] .workflow-name input,
html[data-theme="dark"] .workflow-inspector textarea { border-color: var(--line); background: var(--paper-deep); color: var(--ink); }
html[data-theme="dark"] .workflow-template-tools span,
html[data-theme="dark"] .workflow-inspector-meta,
html[data-theme="dark"] .workflow-guide-steps li > span { background: var(--paper-deep); color: var(--accent-dark); }
html[data-theme="dark"] .workflow-category[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
html[data-theme="dark"] .workflow-canvas-viewport { background-color: var(--paper-deep); }
