Skip to content

Self-improving AI Employees for everyone

29.6 KB
Raw Blame
@import "tailwindcss";
@import "tw-animate-css";
@import "./styles/shadcn.css";
@import "@fontsource-variable/geist";

@plugin "@tailwindcss/typography";

@custom-variant dark (&:is(.dark *));

/* ============================================================================
 * Base resets + Tailwind v4 plumbing.
 *
 * Token VALUES live in the per-theme files (client/src/themes/*.css):
 * light.css / dark.css own the shadcn + dracula + node + action colour
 * hex; base.css owns the shared scale / chrome / shadow / type / tint
 * tokens. This file holds only the global resets and the `@theme inline`
 * bridge that maps `--color-X: var(--X)` so Tailwind utilities resolve
 * against whichever theme is active. Colours are hex / color-mix, so the
 * bridge uses bare var() (no hsl() wrapper); Tailwind v4 still composes
 * `/opacity` via color-mix().
 * ============================================================================ */

@layer base {
  * {
    @apply border-border outline-ring/50;
    box-sizing: border-box;
  }

  html,
  body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    @apply bg-background text-foreground font-sans;
    font-feature-settings: "rlig" 1, "calt" 1;
  }

  /* Tailwind v4 leaves buttons on the arrow; the designs point at them,
   * with each theme's own pointer (--cursor-pointer). */
  button:not(:disabled),
  [role="button"]:not([aria-disabled="true"]) {
    cursor: var(--cursor-pointer, pointer);
  }

  #root {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
}

/* ============================================================================
 * Tailwind v4 @theme inline — exposes our CSS vars as Tailwind tokens
 * (e.g. `bg-background`, `text-primary`, `bg-dracula-green`).
 * ============================================================================ */

@theme inline {
  /* Color tokens are now hex / color-mix (not HSL triplets), so the bridge
   * maps `--color-X: var(--X)` directly — NO hsl() wrapper. Tailwind v4
   * still composes `/opacity` (e.g. bg-primary/50) by wrapping any color
   * in color-mix(), so utilities keep working against hex values. */
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-success: var(--success);
  --color-warning: var(--warning);
  --color-info: var(--info);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);

  --color-dracula-green: var(--dracula-green);
  --color-dracula-purple: var(--dracula-purple);
  --color-dracula-pink: var(--dracula-pink);
  --color-dracula-cyan: var(--dracula-cyan);
  --color-dracula-red: var(--dracula-red);
  --color-dracula-orange: var(--dracula-orange);
  --color-dracula-yellow: var(--dracula-yellow);
  --color-dracula-selection: var(--dracula-selection);
  --color-dracula-current-line: var(--dracula-current-line);
  --color-dracula-comment: var(--dracula-comment);

  /* Node-type tokens — base + soft (tinted bg) + border (tinted outline).
   * Use bg-node-X / bg-node-X-soft / border-node-X-border directly,
   * never with /N opacity arithmetic. */
  --color-node-agent:           var(--node-agent);
  --color-node-agent-soft:      var(--node-agent-soft);
  --color-node-agent-border:    var(--node-agent-border);
  --color-node-model:           var(--node-model);
  --color-node-model-soft:      var(--node-model-soft);
  --color-node-model-border:    var(--node-model-border);
  --color-node-skill:           var(--node-skill);
  --color-node-skill-soft:      var(--node-skill-soft);
  --color-node-skill-border:    var(--node-skill-border);
  --color-node-tool:            var(--node-tool);
  --color-node-tool-soft:       var(--node-tool-soft);
  --color-node-tool-border:     var(--node-tool-border);
  --color-node-trigger:         var(--node-trigger);
  --color-node-trigger-soft:    var(--node-trigger-soft);
  --color-node-trigger-border:  var(--node-trigger-border);
  --color-node-workflow:        var(--node-workflow);
  --color-node-workflow-soft:   var(--node-workflow-soft);
  --color-node-workflow-border: var(--node-workflow-border);

  /* Toolbar / action role tokens — base + -soft + -hover + -border + -ink.
   * Use bg-action-X-soft + text-action-X-ink + border-action-X-border for
   * the standard "soft tinted button" look (see ActionButton CVA). */
  --color-action-run:           var(--action-run);
  --color-action-run-soft:      var(--action-run-soft);
  --color-action-run-hover:     var(--action-run-hover);
  --color-action-run-border:    var(--action-run-border);
  --color-action-run-ink:       var(--action-run-ink);
  --color-action-stop:          var(--action-stop);
  --color-action-stop-soft:     var(--action-stop-soft);
  --color-action-stop-hover:    var(--action-stop-hover);
  --color-action-stop-border:   var(--action-stop-border);
  --color-action-stop-ink:      var(--action-stop-ink);
  --color-action-save:          var(--action-save);
  --color-action-save-soft:     var(--action-save-soft);
  --color-action-save-hover:    var(--action-save-hover);
  --color-action-save-border:   var(--action-save-border);
  --color-action-save-ink:      var(--action-save-ink);
  --color-action-config:        var(--action-config);
  --color-action-config-soft:   var(--action-config-soft);
  --color-action-config-hover:  var(--action-config-hover);
  --color-action-config-border: var(--action-config-border);
  --color-action-config-ink:    var(--action-config-ink);
  --color-action-secret:        var(--action-secret);
  --color-action-secret-soft:   var(--action-secret-soft);
  --color-action-secret-hover:  var(--action-secret-hover);
  --color-action-secret-border: var(--action-secret-border);
  --color-action-secret-ink:    var(--action-secret-ink);
  --color-action-tools:         var(--action-tools);
  --color-action-tools-soft:    var(--action-tools-soft);
  --color-action-tools-hover:   var(--action-tools-hover);
  --color-action-tools-border:  var(--action-tools-border);
  --color-action-tools-ink:     var(--action-tools-ink);

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  --font-sans: 'Geist Variable', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Self-bridge, like --font-display / --font-body below: every theme file
   * declares --font-mono unlayered, so `font-mono` now follows the theme
   * (light / dark keep the same system stack; skins get their own mono).
   * A literal stack here compiled `font-mono` to a fixed value. */
  --font-mono: var(--font-mono);

  /* ── New-contract tokens (design_handoff_machinaos_themes) ──────────
   * Surface / foreground / semantic / typography / radius tokens
   * exposed as Tailwind utilities. Defined per-theme in client/src/
   * themes/<theme>.css (one file per theme) — themes redefine the
   * `--bg-app`, `--fg-default`, etc. CSS variables under
   * `:root[data-theme="..."]`; these `@theme inline` aliases give
   * Tailwind classes that resolve against whichever theme is active.
   *
   * Note: full-colour values (not HSL triplets), so `/opacity` does
   * compile here too: `bg-bg-app/50` becomes
   * `color-mix(in oklab, var(--bg-app) 50%, transparent)` behind an
   * `@supports` guard. Opacity arithmetic at call sites is still
   * forbidden by the frontend rules — use `--bg-overlay` or a named
   * `-soft` / `-tint` token when you need alpha. */
  --color-bg-app:      var(--bg-app);
  --color-bg-panel:    var(--bg-panel);
  --color-bg-canvas:   var(--bg-canvas);
  --color-bg-elevated: var(--bg-elevated);
  --color-bg-input:    var(--bg-input);
  --color-bg-hover:    var(--bg-hover);
  --color-bg-active:   var(--bg-active);
  --color-bg-overlay:  var(--bg-overlay);
  --color-bg-scrim-soft: var(--bg-scrim-soft);

  --color-fg-default:    var(--fg-default);
  --color-fg-muted:      var(--fg-muted);
  --color-fg-faint:      var(--fg-faint);
  --color-fg-on-accent:  var(--fg-on-accent);
  --color-fg-on-success: var(--fg-on-success);
  --color-fg-on-danger:  var(--fg-on-danger);
  --color-fg-on-warning: var(--fg-on-warning);

  /* Border tokens — exposed as Tailwind colour utilities so call sites
   * can write `border-default`, `border-strong`, `border-focus` /
   * `bg-border-default` etc. */
  --color-border-default: var(--border-default);
  --color-border-strong:  var(--border-strong);
  --color-border-focus:   var(--border-focus);

  /* Typography family aliases — `font-display`, `font-body` (and
   * `font-mono` above) track the per-theme family tokens. */
  --font-display: var(--font-display);
  --font-body:    var(--font-body);

  --radius-pill: var(--radius-pill);

  /* ── Home (Normal mode) tokens. Each is a self-bridge onto an unlayered
   * declaration in base.css / light.css / dark.css (the proven
   * --radius-pill pattern), so the utilities follow the active theme. ── */
  --color-node-agent-fill:     var(--node-agent-fill);
  --color-node-agent-hover:    var(--node-agent-hover);
  --color-node-agent-edge:     var(--node-agent-edge);
  --color-node-agent-ink:      var(--node-agent-ink);
  --color-node-model-fill:     var(--node-model-fill);
  --color-node-model-hover:    var(--node-model-hover);
  --color-node-model-edge:     var(--node-model-edge);
  --color-node-model-ink:      var(--node-model-ink);
  --color-node-skill-fill:     var(--node-skill-fill);
  --color-node-skill-hover:    var(--node-skill-hover);
  --color-node-skill-edge:     var(--node-skill-edge);
  --color-node-skill-ink:      var(--node-skill-ink);
  --color-node-tool-fill:      var(--node-tool-fill);
  --color-node-tool-hover:     var(--node-tool-hover);
  --color-node-tool-edge:      var(--node-tool-edge);
  --color-node-tool-ink:       var(--node-tool-ink);
  --color-node-trigger-fill:   var(--node-trigger-fill);
  --color-node-trigger-hover:  var(--node-trigger-hover);
  --color-node-trigger-edge:   var(--node-trigger-edge);
  --color-node-trigger-ink:    var(--node-trigger-ink);
  --color-node-workflow-fill:  var(--node-workflow-fill);
  --color-node-workflow-hover: var(--node-workflow-hover);
  --color-node-workflow-edge:  var(--node-workflow-edge);
  --color-node-workflow-ink:   var(--node-workflow-ink);

  --text-2xs:   var(--text-2xs);
  --text-md:    var(--text-md);
  --text-micro: var(--text-micro);
  --text-meta:  var(--text-meta);
  --text-row:   var(--text-row);
  --text-lead:  var(--text-lead);
  --text-title: var(--text-title);
  --text-headline: var(--text-headline);
  --text-hero:  var(--text-hero);

  --radius-row:      var(--radius-row);
  --radius-card:     var(--radius-card);
  --radius-panel:    var(--radius-panel);
  --radius-draft:    var(--radius-draft);
  --radius-composer: var(--radius-composer);

  --shadow-float:   var(--shadow-float);
  --shadow-popover: var(--shadow-popover);
  --shadow-dialog:  var(--shadow-dialog);
  --shadow-dock:    var(--shadow-dock);
  --shadow-pip:     var(--shadow-pip);
  /* The green "Connected" glow (light.css, dark.css), held while it shows. */
  --shadow-glow-connect: var(--glow-connect);
  /* Design-system elevation steps (base.css, dark.css), used by the chat. */
  --shadow-card:       var(--shadow-card);
  --shadow-card-hover: var(--shadow-card-hover);
  --shadow-knob:       var(--shadow-knob);
  --shadow-modal:      var(--shadow-modal);

  --blur-scrim: var(--blur-scrim);

  /* Employee status tokens (themes/base.css) -> bg-status-working-fill, … */
  --color-status-working-dot: var(--status-working-dot);
  --color-status-working-ink: var(--status-working-ink);
  --color-status-working-fill: var(--status-working-fill);
  --color-status-working-border: var(--status-working-border);
  --color-status-ready-dot: var(--status-ready-dot);
  --color-status-ready-ink: var(--status-ready-ink);
  --color-status-ready-fill: var(--status-ready-fill);
  --color-status-ready-border: var(--status-ready-border);
  --color-status-paused-dot: var(--status-paused-dot);
  --color-status-paused-ink: var(--status-paused-ink);
  --color-status-paused-fill: var(--status-paused-fill);
  --color-status-paused-border: var(--status-paused-border);
  --color-status-attention-dot: var(--status-attention-dot);
  --color-status-attention-ink: var(--status-attention-ink);
  --color-status-attention-fill: var(--status-attention-fill);
  --color-status-attention-border: var(--status-attention-border);
  --color-status-waiting-dot: var(--status-waiting-dot);
  --color-status-waiting-ink: var(--status-waiting-ink);
  --color-status-waiting-fill: var(--status-waiting-fill);
  --color-status-waiting-border: var(--status-waiting-border);

  /* Error surfaces (themes/base.css) -> bg-danger-soft, border-danger-border */
  --color-danger-soft:   var(--danger-soft);
  --color-danger-border: var(--danger-border);

  --ease-spring:    var(--ease-spring);
  --ease-overshoot: var(--ease-overshoot);
  --ease-reveal:    var(--ease-reveal);
  --ease-default:   var(--ease-default);
  --ease-emphasis:  var(--ease-emphasis);

  --tracking-label:    var(--tracking-label);
  --tracking-hero:     var(--tracking-hero);
  --leading-hero:      var(--leading-hero);

  /* Code & syntax tokens -> Tailwind utilities (text-code-tag, bg-code-bg, …).
   * Defined per-theme in client/src/themes/<theme>.css. */
  --color-code-bg:          var(--code-bg);
  --color-code-gutter-bg:   var(--code-gutter-bg);
  --color-code-gutter-fg:   var(--code-gutter-fg);
  --color-code-text:        var(--code-text);
  --color-code-comment:     var(--code-comment);
  --color-code-keyword:     var(--code-keyword);
  --color-code-string:      var(--code-string);
  --color-code-number:      var(--code-number);
  --color-code-boolean:     var(--code-boolean);
  --color-code-function:    var(--code-function);
  --color-code-property:    var(--code-property);
  --color-code-operator:    var(--code-operator);
  --color-code-punctuation: var(--code-punctuation);
  --color-code-tag:         var(--code-tag);
}

/* ============================================================================
 * React Flow chrome — light + dark
 * ============================================================================ */

/* `.react-flow` is intentionally transparent so the parent
 * `.canvas-host` / `.canvas` `background-image` (per-theme
 * `--canvas-grid` + multi-layer gradient stack) paints through.
 * Per the upstream v11 stylesheet, `.react-flow` ships with only
 * `direction: ltr;` — no background. Painting one here would hide
 * the per-theme decoration (Atomic's starburst). When migrating
 * to @xyflow/react v12, set `--xy-background-color: transparent;`
 * on `.xy-flow` (v12 sets a default opaque background via custom
 * property). */

/* The editor's dot grid (Dashboard's <Background>): drawn in light and
 * dark, transparent in Atomic (--grid-dot, themes/*.css). */
.react-flow__background pattern circle {
  fill: var(--grid-dot) !important;
}

.react-flow__controls,
.react-flow__minimap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
}

.dark .react-flow__controls,
.dark .react-flow__minimap {
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);
}

.react-flow__controls button {
  background: var(--card);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.react-flow__controls button:last-child {
  border-bottom: none;
}

.react-flow__controls button:hover {
  background: var(--muted);
}

.react-flow__controls button svg,
.react-flow__controls button svg path {
  fill: var(--foreground) !important;
}

.react-flow__attribution {
  background: color-mix(in srgb, var(--card) 90%, transparent);
  color: var(--muted-foreground);
}

.react-flow__selection {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
}

.react-flow__connection-line {
  stroke: var(--muted-foreground);
  stroke-width: 2;
}

/* ============================================================================
 * Brand-color tint utilities — for sites where the color is data-driven
 * (provider.color, definition.defaults.color, skill.color) and can't
 * use a node-X token. Apply alongside `style={{ color: brandColor }}`
 * (or any class that sets the foreground color); these utilities mix
 * `currentColor` against `transparent` at the canonical alphas defined
 * in :root (`--tint-soft`, `--tint-border`).
 * ============================================================================ */

.bg-tint-soft {
  background-color: color-mix(in srgb, currentColor var(--tint-soft), transparent);
}

.border-tint {
  border-color: color-mix(in srgb, currentColor var(--tint-border), transparent);
}

/* ============================================================================
 * Scrollbars
 * ============================================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-faint);
}

::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ============================================================================
 * Animations
 * ============================================================================ */

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.03); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================================
 * Normal mode: the pill toast (features/home/ui/pillToast.tsx) springs up
 * from 16px below at .96 scale, and drops 10px as it fades (design handoff
 * "Toast"), in place of sonner's own slide. Each selector out-specifies the
 * sonner rule it replaces (sonner injects its stylesheet after this one);
 * sonner turns every transition off under reduced motion.
 * ============================================================================ */

.pill-toaster [data-sonner-toast][data-y-position] {
  --y: translateY(16px) scale(0.96);
  transition:
    transform var(--dur-toast-in) var(--ease-spring),
    opacity var(--dur-toast-in) var(--ease-spring);
}

.pill-toaster [data-sonner-toast][data-mounted='true'] {
  --y: none;
}

.pill-toaster [data-sonner-toast][data-removed='true'][data-front='true'][data-swipe-out='false'] {
  --y: translateY(10px);
  opacity: 0;
  transition:
    transform var(--dur-toast-out) var(--ease-default),
    opacity var(--dur-toast-out) var(--ease-default);
}

/* ============================================================================
 * Normal mode: a working employee's status pip breathes a ring (design
 * handoff "pulsing ring": 0 to 6px over the whole loop). A CSS keyframe
 * rather than a Web Animation so the page-hidden pause in base.css covers
 * it. The ring grows from the pip's border box, outside its panel ring.
 * ============================================================================ */

@keyframes home-pip-ring {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-working-ink) var(--tint-pip-ring), transparent);
  }
  100% {
    box-shadow: 0 0 0 6px transparent;
  }
}

.home-pip[data-pip="on"] {
  animation: home-pip-ring var(--dur-pip-loop) ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .home-pip[data-pip="on"] {
    animation: none;
  }
}

/* ============================================================================
 * Welcome guide (Home onboarding): the demo stage. Two soft washes over the
 * app surface, the agent fill from the top right and the model tint from
 * the bottom left (design handoff A1).
 * ============================================================================ */

.home-welcome-stage {
  background:
    radial-gradient(110% 80% at 100% 0%, var(--node-agent-fill), transparent 60%),
    radial-gradient(100% 80% at 0% 100%, var(--node-model-soft), transparent 65%),
    var(--bg-app);
}

/* ============================================================================
 * Theme switch (ThemeContext.setTheme with `reveal`).
 *
 * The circular reveal is a View Transition whose new root is clipped open
 * from the button by a Web Animation (lib/motion + ThemeContext). The UA's
 * default cross-fade is turned off so only that animation runs, and element
 * transitions are suspended while the snapshot swaps so colours don't smear
 * inside the circle. Without View Transitions support the fallback fades
 * colours for --dur-theme-fade instead.
 * ============================================================================ */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html.oc-theme-swapping *,
html.oc-theme-swapping *::before,
html.oc-theme-swapping *::after {
  transition: none !important;
}

html.oc-theme-fade *,
html.oc-theme-fade *::before,
html.oc-theme-fade *::after {
  transition:
    background-color var(--dur-theme-fade) ease,
    color var(--dur-theme-fade) ease,
    border-color var(--dur-theme-fade) ease,
    fill var(--dur-theme-fade) ease,
    box-shadow var(--dur-theme-fade) ease !important;
}

@media (prefers-reduced-motion: reduce) {
  html.oc-theme-fade *,
  html.oc-theme-fade *::before,
  html.oc-theme-fade *::after {
    transition: none !important;
  }
}

/* ============================================================================
 * ConsolePanel — Prism token colors + chat markdown theming.
 * Static CSS vars; dark-mode overrides via `.dark` cascade.
 * ============================================================================ */

.console-json-output .token.string { color: var(--code-string); }
.console-json-output .token.number,
.console-json-output .token.boolean,
.console-json-output .token.null { color: var(--code-number); }
.console-json-output .token.property { color: var(--code-tag); }
.console-json-output .token.punctuation { color: var(--code-punctuation); }
.console-json-output .token.operator { color: var(--code-operator); }

/* ----------------------------------------------------------------------------
 * @uiw/react-json-view — palette mapped onto the theme's --code-* tokens.
 *
 * The library reads every colour as `var(--w-rjv-*, <fallback>)` (see its
 * esm/index.js), so its documented theming API is plain CSS custom properties.
 * Declaring them here rather than passing one of its bundled theme objects
 * through the `style` prop means: every <JsonView> in the app is themed with no
 * per-call-site code, and every theme repaints on `data-theme` change through
 * the normal cascade instead of a React re-render.
 * -------------------------------------------------------------------------- */

:root {
  --w-rjv-background-color: var(--code-bg);
  --w-rjv-color: var(--code-text);
  --w-rjv-key-string: var(--code-tag);
  --w-rjv-line-color: var(--code-border);
  --w-rjv-arrow-color: var(--code-gutter-fg);
  --w-rjv-info-color: var(--code-comment);
  --w-rjv-ellipsis-color: var(--code-comment);
  --w-rjv-brackets-color: var(--code-punctuation);
  --w-rjv-curlybraces-color: var(--code-punctuation);
  --w-rjv-colon-color: var(--code-punctuation);
  --w-rjv-quotes-color: var(--code-string);
  --w-rjv-quotes-string-color: var(--code-string);
  --w-rjv-type-string-color: var(--code-string);
  --w-rjv-type-int-color: var(--code-number);
  --w-rjv-type-float-color: var(--code-number);
  --w-rjv-type-bigint-color: var(--code-number);
  --w-rjv-type-boolean-color: var(--code-boolean);
  --w-rjv-type-null-color: var(--code-number);
  --w-rjv-type-nan-color: var(--code-number);
  --w-rjv-type-undefined-color: var(--code-comment);
  --w-rjv-type-date-color: var(--code-string);
}

/* Markdown in chat replies (Home and Dev) and console rows. Every surface
 * reads a theme token, so a reply's code and tables stay visible on the
 * light family's white bubble too, and every theme paints them its own way. */
.chat-markdown p { margin: 0 0 8px 0; }
.chat-markdown p:last-child { margin-bottom: 0; }
.chat-markdown h1,
.chat-markdown h2,
.chat-markdown h3 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  color: var(--fg-default);
}
.chat-markdown h1:first-child,
.chat-markdown h2:first-child,
.chat-markdown h3:first-child { margin-top: 0; }
.chat-markdown h1 { font-size: 1.25em; }
.chat-markdown h2 { font-size: 1.1em; }
.chat-markdown h3 { font-size: 1em; }
.chat-markdown strong { font-weight: 600; color: var(--fg-default); }
.chat-markdown em { font-style: italic; }
/* Tailwind's preflight removes list markers; replies need them back. */
.chat-markdown ul,
.chat-markdown ol { margin: 8px 0; padding-left: 22px; }
.chat-markdown ul { list-style: disc; }
.chat-markdown ol { list-style: decimal; }
.chat-markdown ul ul { list-style: circle; }
.chat-markdown li { margin: 4px 0; }
.chat-markdown li::marker {
  color: var(--fg-faint);
  font-family: var(--font-mono);
}
.chat-markdown code {
  background-color: var(--bg-active);
  border: 1px solid var(--border-default);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.chat-markdown pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border, var(--border-default));
  padding: 12px;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 8px 0;
}
.chat-markdown pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}
.chat-markdown table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 0.9em;
}
.chat-markdown th,
.chat-markdown td {
  border: 1px solid var(--border-default);
  padding: 6px 10px;
  text-align: left;
}
.chat-markdown th {
  background-color: var(--bg-panel);
  color: var(--fg-muted);
  font-weight: 600;
}
.chat-markdown blockquote {
  border-left: 3px solid var(--border-strong);
  margin: 8px 0;
  padding: 2px 0 2px 14px;
  color: var(--fg-muted);
}
.chat-markdown a {
  color: var(--action-save-ink);
  text-decoration: none;
}
.chat-markdown a:hover { text-decoration: underline; }
.chat-markdown img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}
.chat-markdown hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 12px 0;
}
/* While an answer streams, a pulsing dot follows its last words (design
 * handoff chat, "Streaming"): at the end of the last block, or of a list's
 * last item. */
.chat-markdown[data-streaming] > :last-child::after,
.chat-markdown[data-streaming] > :is(ul, ol):last-child > li:last-child::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 5px;
  vertical-align: -0.5px;
  border-radius: 50%;
  background: var(--action-tools-ink);
  box-shadow: 0 0 0 3px var(--action-tools-soft), 0 0 14px var(--action-tools-border);
  animation: opencompany-caret-pulse var(--dur-caret, 1000ms) ease-in-out infinite;
}
.chat-markdown[data-streaming] > :is(ul, ol):last-child::after { content: none; }
@media (prefers-reduced-motion: reduce) {
  .chat-markdown[data-streaming] > :last-child::after,
  .chat-markdown[data-streaming] > :is(ul, ol):last-child > li:last-child::after { animation: none; }
}

/* ============================================================================
 * Syntax-highlighting palette — used by react-simple-code-editor + the
 * console/output JSON viewers. Token colors read the per-theme --code-*
 * tokens (defined in client/src/themes/<theme>.css), so each theme paints
 * code in its own palette on its own code surface.
 * ============================================================================ */

.code-editor-container { background: var(--code-bg); }
/* Chat code blocks share the editor's per-theme palette. */
.code-editor-container .token.comment,     .chat-markdown .token.comment     { color: var(--code-comment); }
.code-editor-container .token.string,      .chat-markdown .token.string      { color: var(--code-string); }
.code-editor-container .token.keyword,     .chat-markdown .token.keyword     { color: var(--code-keyword); }
.code-editor-container .token.function,    .chat-markdown .token.function    { color: var(--code-function); }
.code-editor-container .token.number,      .chat-markdown .token.number      { color: var(--code-number); }
.code-editor-container .token.operator,    .chat-markdown .token.operator    { color: var(--code-operator); }
.code-editor-container .token.class-name,  .chat-markdown .token.class-name  { color: var(--code-property); }
.code-editor-container .token.builtin,     .chat-markdown .token.builtin     { color: var(--code-property); }
.code-editor-container .token.boolean,     .chat-markdown .token.boolean     { color: var(--code-boolean); }
.code-editor-container .token.punctuation, .chat-markdown .token.punctuation { color: var(--code-punctuation); }
.chat-markdown .token.property { color: var(--code-property); }
.code-editor-container textarea           { outline: none !important; caret-color: var(--code-caret); }
.code-editor-container textarea::placeholder { color: var(--muted-foreground); }