/* Shared appearance: semantic colors, then aliases for incumbent surfaces.
   Navigation stays charcoal; images, QR codes and code consoles keep their own
   materials. No color inversion/filter and no task or layout behavior changes. */
:root {
  --workspace-page: #edf0eb;
  --workspace-ink: #1b241e;
  --workspace-secondary: #566159;
  --workspace-surface: #ffffff;
  --workspace-soft: #f3f5f2;
  --workspace-raised: #e8ede5;
  --workspace-edge: #d9dfd7;
  --workspace-field-edge: #879580;
  --workspace-focus: #546c34;
  --workspace-on-solid: #ffffff;
  --workspace-solid-hover: #36462e;
  --workspace-selected: #edf3e1;
  --workspace-selected-edge: #748963;
  --workspace-accent: #deec71;
  --workspace-accent-ink: #18201a;
  --workspace-error: #a33224;
  --workspace-error-soft: #fff0eb;
  --workspace-success: #237642;
  --workspace-success-soft: #edf6ee;
  --workspace-warning: #8a501c;
  --workspace-warning-soft: #f8eee2;
  --workspace-blue: #315d9f;
  --workspace-blue-soft: #edf2f9;
  --workspace-scrim: rgba(13, 20, 15, .56);
  --workspace-shadow: 0 12px 32px rgba(14, 20, 16, .14);
}
html[data-theme="dark"] {
  --workspace-page: #121713;
  --workspace-ink: #e9eee5;
  --workspace-secondary: #bcc7b7;
  --workspace-surface: #1e241e;
  --workspace-soft: #232b22;
  --workspace-raised: #303a2d;
  --workspace-edge: #3e4a38;
  --workspace-field-edge: #74856c;
  --workspace-focus: #deec71;
  --workspace-on-solid: #18201a;
  --workspace-solid-hover: #dbe4d4;
  --workspace-selected: #303d26;
  --workspace-selected-edge: #849b70;
  --workspace-error: #ffab98;
  --workspace-error-soft: #39261f;
  --workspace-success: #96d4aa;
  --workspace-success-soft: #213728;
  --workspace-warning: #f3c591;
  --workspace-warning-soft: #3a3023;
  --workspace-blue: #9fc3ff;
  --workspace-blue-soft: #243041;
  --workspace-scrim: rgba(5, 10, 6, .72);
  --workspace-shadow: 0 12px 32px rgba(0, 0, 0, .4);
}
html[data-theme="light"], html[data-theme="light"] body { color-scheme: light; }
html[data-theme="dark"], html[data-theme="dark"] body { color-scheme: dark; }
html[data-theme] body {
  --room: var(--workspace-page); --ink: var(--workspace-soft);
  --panel: var(--workspace-surface); --panel-2: var(--workspace-soft);
  --bone: var(--workspace-ink); --bone-hi: var(--workspace-solid-hover);
  --bone-dim: var(--workspace-secondary); --faint: var(--workspace-secondary);
  --on-bone: var(--workspace-on-solid); --code-fg: var(--workspace-ink);
  --strong-fg: var(--workspace-ink); --glacier: var(--workspace-ink);
  --glacier-dim: var(--workspace-secondary); --glacier-sunk: var(--workspace-soft);
  --edge: var(--workspace-edge); --edge-soft: var(--workspace-edge); --edge-strong: var(--workspace-field-edge);
  --ember: var(--workspace-error); --ember-soft: var(--workspace-error); --ember-sunk: var(--workspace-error-soft);
  --on-ember: var(--workspace-on-solid); --scrim: var(--workspace-scrim);
  --lane: var(--workspace-accent); --lane-ink: var(--workspace-accent-ink);
  --pg-page: var(--workspace-page); --pg-frame: var(--workspace-surface); --pg-side: var(--workspace-soft);
  --pg-frame-edge: var(--workspace-edge); --pg-hair: var(--workspace-edge); --pg-field: var(--workspace-soft);
  --pg-ink: var(--workspace-ink); --pg-ink-2: var(--workspace-secondary); --pg-muted: var(--workspace-secondary);
  --pg-ember: var(--workspace-error); --pg-live: var(--workspace-success); --pg-lime: var(--workspace-accent);
  background-color: var(--workspace-page); color: var(--workspace-ink);
}
/* Work's historic neutral ramp is local to its tables, drawers and results. */
html[data-theme] body {
  --ops-page: var(--workspace-page); --ops-frame: var(--workspace-surface); --ops-rail: var(--workspace-soft);
  --ops-ink: var(--workspace-ink); --ops-ink-2: var(--workspace-secondary); --ops-muted: var(--workspace-secondary);
  --ops-field: var(--workspace-soft); --ops-line: var(--workspace-edge); --ops-line-2: var(--workspace-edge); --ops-hair: var(--workspace-edge);
  --ops-hover: var(--workspace-soft); --ops-live: var(--workspace-accent); --ops-live-ink: var(--workspace-accent-ink);
  --ops-bad: var(--workspace-error); --ops-bad-soft: var(--workspace-error-soft); --ops-ok: var(--workspace-success);
  --ops-ok-soft: var(--workspace-success-soft); --ops-warn: var(--workspace-warning); --ops-warn-soft: var(--workspace-warning-soft);
  --muted: var(--workspace-secondary); --danger: var(--workspace-error); --line: var(--workspace-edge);
}
html body :is(#secResults, #secCrons) { --ops-muted: var(--workspace-secondary); }
html body .page-frame { background-color: var(--workspace-surface); }
html body :is(.view, .ck, .page-frame) :is(input, textarea)::placeholder { color: var(--workspace-secondary); opacity: 1; }
html body :is(.view, .ck, .page-frame) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { background-color: var(--workspace-soft); border-color: var(--workspace-field-edge); }
html body .studio-start :is(input, select), html body .studio #mediaSort { background-color: var(--workspace-soft); border-color: var(--workspace-field-edge); }
html body .receipt-uncertain, html body .studio .receipt-state.is-unknown, html body .workspace-connection { background: var(--workspace-warning-soft); color: var(--workspace-warning); border-color: var(--workspace-field-edge); }
html body .schedule-success { color: var(--workspace-success); }
html body .cron-slab .seg { background: var(--workspace-soft); border-color: var(--workspace-field-edge); }
html body .cron-slab .seg button { color: var(--workspace-secondary); }
html body .cron-slab .seg button[aria-checked="true"] { background: var(--workspace-ink); color: var(--workspace-on-solid); }
html body .ap-entry-example p, html body .sh-signin .foot a { color: var(--workspace-secondary); }
html body .ap {
  --ap-page: var(--workspace-page);
  --ap-frame: var(--workspace-surface);
  --ap-side: var(--workspace-soft);
  --ap-card: var(--workspace-surface);
  --ap-field: var(--workspace-soft);
  --ap-search: var(--workspace-raised);
  --ap-thumb: var(--workspace-raised);
  --ap-frame-edge: var(--workspace-edge);
  --ap-card-edge: var(--workspace-edge);
  --ap-field-edge: var(--workspace-field-edge);
  --ap-control-edge: var(--workspace-field-edge);
  --ap-hair: var(--workspace-edge);
  --ap-ink: var(--workspace-ink);
  --ap-ink-2: var(--workspace-secondary);
  --ap-muted: var(--workspace-secondary);
  --ap-on-ink: var(--workspace-on-solid);
  --ap-ink-hi: var(--workspace-solid-hover);
  --ap-live: var(--workspace-accent);
  --ap-live-ink: var(--workspace-accent-ink);
  --ap-bad: var(--workspace-error);
  --ap-bad-soft: var(--workspace-error-soft);
  --ap-bad-ink: var(--workspace-error);
  --ap-ghost: var(--workspace-raised);
  color-scheme: inherit;
}
html body .studio {
  --st-page: var(--workspace-page);
  --st-frame: var(--workspace-surface);
  --st-side: var(--workspace-soft);
  --st-card: var(--workspace-surface);
  --st-field: var(--workspace-soft);
  --st-search: var(--workspace-raised);
  --st-thumb: var(--workspace-raised);
  --st-frame-edge: var(--workspace-edge);
  --st-card-edge: var(--workspace-edge);
  --st-field-edge: var(--workspace-field-edge);
  --st-control-edge: var(--workspace-field-edge);
  --st-hair: var(--workspace-edge);
  --st-ink: var(--workspace-ink);
  --st-ink-2: var(--workspace-secondary);
  --st-muted: var(--workspace-secondary);
  --st-on-ink: var(--workspace-on-solid);
  --st-ink-hi: var(--workspace-solid-hover);
  --st-live: var(--workspace-accent);
  --st-live-ink: var(--workspace-accent-ink);
  --st-bad: var(--workspace-error);
  --st-bad-soft: var(--workspace-error-soft);
  --st-bad-ink: var(--workspace-error);
  --st-ghost: var(--workspace-raised);
  color-scheme: inherit;
}
html body #main.ck {
  --ck-ink: var(--workspace-ink); --ck-muted: var(--workspace-secondary); --ck-faint: var(--workspace-secondary);
  --ck-canvas: var(--workspace-surface); --ck-card: var(--workspace-surface); --ck-card-edge: var(--workspace-edge);
  --ck-data: var(--workspace-ink);
  --ck-label: var(--workspace-secondary); --ck-tab-track: var(--workspace-soft); --ck-tab-active: var(--workspace-surface);
  --ck-green: var(--workspace-success); --ck-success-ink: var(--workspace-success); --ck-orange: var(--workspace-warning);
  --ck-blue: var(--workspace-blue); --ck-red: var(--workspace-error); --ck-lime: var(--workspace-accent);
  --bone: var(--workspace-ink); --bone-dim: var(--workspace-secondary); --faint: var(--workspace-secondary);
  --ink: var(--workspace-surface); --room: var(--workspace-surface); --panel: var(--workspace-surface); --panel-2: var(--workspace-soft);
  --edge: var(--workspace-edge); --edge-soft: var(--workspace-edge); --edge-strong: var(--workspace-field-edge);
  --glacier: var(--workspace-success); --glacier-dim: var(--workspace-secondary);
  --ember: var(--workspace-error); --ember-soft: var(--workspace-error); --ember-sunk: var(--workspace-error-soft);
  --on-bone: var(--workspace-on-solid); --lane-ink: var(--workspace-accent-ink);
}
html body[data-shell="desk"] .app {
  --desk-page: var(--workspace-page); --desk-frame: var(--workspace-surface); --desk-side: var(--workspace-soft);
  --desk-canvas: var(--workspace-surface); --desk-card: var(--workspace-surface); --desk-field: var(--workspace-soft);
  --desk-search: var(--workspace-raised); --desk-frame-edge: var(--workspace-edge); --desk-card-edge: var(--workspace-edge);
  --desk-field-edge: var(--workspace-field-edge); --desk-hair: var(--workspace-edge);
  --desk-ink: var(--workspace-ink); --desk-ink-2: var(--workspace-secondary); --desk-muted: var(--workspace-secondary);
  --desk-on-ink: var(--workspace-on-solid); --desk-ink-hi: var(--workspace-solid-hover);
  --desk-paper: var(--workspace-surface); --desk-bubble: var(--workspace-soft); --desk-paper-edge: var(--workspace-edge);
}
html body .guide { --guide-muted: var(--workspace-secondary); }
html body :is(.ap, .studio, .view, .ck, .page-frame) .btn-solid { color: var(--workspace-on-solid); }
html body :is(.ap, .studio, .view, .ck, .page-frame) .btn-solid:hover { background: var(--workspace-solid-hover); border-color: var(--workspace-solid-hover); }
html body .ap-form-foot #apRunBtn, html body .studio .tool-foot .btn-solid { color: var(--workspace-accent-ink); }
html body :is(.ap, .studio, .view, .ck, .page-frame) :is(input, textarea, select) { color: var(--workspace-ink); caret-color: var(--workspace-ink); }
html body :is(.ap, .studio, .view, .ck, .page-frame) :is(input, textarea, select)[aria-invalid="true"] { border-color: var(--workspace-error); outline-color: var(--workspace-error); }
html body :is(button, input, select, textarea, a, summary):focus-visible { outline-color: var(--workspace-focus); }
html body :is(.app, .ap, .studio, .ck, .page-frame, .gate) { scrollbar-color: var(--workspace-field-edge) transparent; }
html body ::selection { background: var(--workspace-selected); color: var(--workspace-ink); }
html body .connections ::selection { background: var(--workspace-accent); color: var(--workspace-accent-ink); }
html body .gmail-badge[data-connected="true"], html body .google-task-tabs > button[aria-selected="true"] { color: var(--workspace-accent-ink); }
/* Icon plates and selected task choices use a tonal surface, not inverted photos. */
html body .ap-card:hover { background: var(--workspace-soft); border-color: var(--workspace-field-edge); }
html body .ap-card[aria-current="true"], html body .studio .mode[aria-selected="true"],
html body .ap-title-row button[aria-pressed="true"], html body .ap-filters button[aria-pressed="true"],
html body .filters .chip.is-on, html body .ck .admin-nav a[aria-current="page"] { background: var(--workspace-selected); color: var(--workspace-ink); border-color: var(--workspace-selected-edge); }
html body .ap-card-ic, html body .ap-card[aria-current="true"] .ap-card-ic, html body .studio .mode-ic,
html body .studio .mode[aria-selected="true"] .mode-ic { background: var(--workspace-raised); color: var(--workspace-ink); }
html body .studio .mode[aria-selected="true"] :is(strong, small, .mode-n) { color: var(--workspace-ink); }
html body :is(.ap-ask, .studio #promptInput, #cronMessage) { background: var(--workspace-surface); }
html body .studio-start { background: var(--workspace-selected); }
html body .ap-flow-guide svg { color: var(--workspace-success); }
html body .ap-run-clock { color: var(--ap-on-ink); }
html body .studio .asset-tick { background: var(--workspace-surface); color: var(--workspace-ink); }
html body .studio .asset-tick:hover { background: var(--workspace-soft); }
html body .studio .asset-tick.is-on { background: var(--workspace-ink); color: var(--workspace-on-solid); }
html body .studio .error-text, html body .files-problem p { color: var(--workspace-error); }
html body :is(.verb.post, .need.must) { color: var(--workspace-on-solid); }
html body .skip-link { color: var(--workspace-ink); background: var(--workspace-surface); }
html body .connections .btn-solid:hover { color: var(--workspace-on-solid); }
html body .pill.is-ok { background: var(--workspace-success-soft); color: var(--workspace-success); }
html body .pill.is-warn { background: var(--workspace-warning-soft); color: var(--workspace-warning); }
html body .pill.is-bad { background: var(--workspace-error-soft); color: var(--workspace-error); }
html body .fact-v.is-bad, html body .err-top .tape:first-child, html body .page-frame .error-text { color: var(--workspace-error); }
html body .fact:has(.dot.is-ok) .fact-v { color: var(--workspace-success); }
html body .fact:has(.dot.is-warn) .fact-v { color: var(--workspace-warning); }
html body .err-row { background: var(--workspace-error-soft); }
html body .host-acct-chip.is-ok, html body .conn-health-list li.is-on .conn-health-state { color: var(--workspace-success); background: var(--workspace-success-soft); }
html body .host-acct-chip.is-bad, html body .conn-health-list li.is-off .conn-health-state, html body #main.ck .host-step-err,
html body #connectorGrid .connector-probe.is-bad { color: var(--workspace-error); background: var(--workspace-error-soft); }
html body #main.ck .host-acct-chip.is-wait { color: var(--workspace-warning); background: var(--workspace-warning-soft); }
html body .connector-status.is-ok { background: var(--workspace-success-soft); color: var(--workspace-success); }
html body :is(.connector-status.is-off, .connector-empty) { background: var(--workspace-error-soft); color: var(--workspace-error); }
html body .policy-box { background: var(--workspace-soft); color: var(--workspace-ink); }
html body #connectorGrid .connector-detail { color: var(--workspace-secondary); }
html body .conn-health-list li > a:hover, html body #connectorGrid .connector-test:hover { background: var(--workspace-soft); }
/* Sign-in is usable before authenticated Desk sheets have loaded. */
html body.entry-pending .gate { background: var(--workspace-surface); }
html body.entry-pending :is(.entry-language, .gate-lede, .gate-foot, .entry-help) { color: var(--workspace-secondary); }
html body.entry-pending :is(.fld input, .entry-language select) { background: var(--workspace-soft); color: var(--workspace-ink); border-color: var(--workspace-field-edge); }
html body.entry-pending input::placeholder { color: var(--workspace-secondary); }
html body.entry-pending .btn-solid { background: var(--workspace-ink); color: var(--workspace-on-solid); }
html body.entry-pending :is(.btn-quiet, .entry-help a) { color: var(--workspace-secondary); }
html body.entry-pending .error-text { color: var(--workspace-error); }
/* Menus inherit the surface palette; the existing top navigation stays charcoal. */
html .pbar-menu, html .sh-palette, html .sh-login {
  --pb-card: var(--workspace-surface); --pb-field: var(--workspace-soft);
  --pb-ink: var(--workspace-ink); --pb-ink-hi: var(--workspace-solid-hover); --pb-on-ink: var(--workspace-on-solid);
  --pb-ink-2: var(--workspace-secondary); --pb-muted: var(--workspace-secondary);
  --pb-edge: var(--workspace-edge); --pb-edge-hi: var(--workspace-field-edge); --pb-bad: var(--workspace-error);
}
html .pbar-menu .appearance-control { margin: 8px 4px; }
html .pbar-menu .appearance-label { margin: 0 0 8px; color: var(--pb-ink); font-size: 13px; font-weight: 600; }
html .pbar-menu .appearance-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
html .pbar-menu .appearance-choices button { display: block; padding: 10px 4px; min-width: 0; min-height: 44px; border: 1px solid var(--pb-edge-hi); border-radius: 8px; font-size: 14px; text-align: center; white-space: normal; }
html .pbar-menu .appearance-choices button[aria-checked="true"] { background: var(--workspace-selected); border-color: var(--workspace-selected-edge); color: var(--workspace-ink); font-weight: 700; }
html .pbar-menu .appearance-note { font-size: 13px; line-height: 1.6; margin: 12px 0 0; color: var(--workspace-secondary); overflow-wrap: anywhere; }
/* Printing a Guide remains paper even when the workspace follows a dark OS. */
@media print {
  html body .guide { --pg-frame: #fff; --pg-side: #fff; --pg-ink: #000; --pg-ink-2: #000; --guide-muted: #000; background: #fff; color: #000; }
}
@media (forced-colors: active) {
  html .pbar-menu .appearance-choices button[aria-checked="true"] { background: Highlight; color: HighlightText; border-color: Highlight; }
}
