Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

5.4 KB
Raw Blame
/**
 * Base stylesheet for a workflow's own page (features/workflows/workflow-tabs.tsx injects it
 * into the frame, and a page may link it itself for standalone viewing).
 *
 * A workflow page is a separate document: Tailwind never sees it, and the app's `html.dark`
 * class and accent variables stop at the frame boundary. So the app copies its RESOLVED
 * tokens — the gray scale, the accent pair, the font stack, the root font size — onto this
 * document's root (lib/workflow-theme.ts), and everything here is expressed in those
 * variables. The literal fallbacks are only for a page opened outside the app; the palette
 * has exactly one source of truth, styles.css.
 *
 * This is a floor, not a framework: it styles the plain HTML an agent writes (headings,
 * lists, forms, tables, code) and gets out of the way. It is injected FIRST in the head, so
 * a page's own rules always win.
 */

:root {
  color-scheme: light;
  --wf-bg: #ffffff;
  --wf-surface: var(--color-gray-50, #fafafa);
  --wf-fg: var(--color-gray-900, #171717);
  --wf-muted: var(--color-gray-500, #737373);
  --wf-border: var(--color-gray-200, #e5e5e5);
  --wf-hover: var(--color-gray-100, #f5f5f5);
  --wf-accent: var(--ui-accent, #171717);
  --wf-accent-fg: var(--ui-accent-fg, #ffffff);
  --wf-radius: 6px;
  --wf-font: var(
    --font-app-sans,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif
  );
  --wf-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* The app stamps `dark` or `light` on the root; `prefers-color-scheme` only decides for a
   page opened on its own, where no class is stamped at all. */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    color-scheme: dark;
    --wf-bg: var(--color-gray-950, #121212);
    --wf-surface: var(--color-gray-900, #1a1a1a);
    --wf-fg: var(--color-gray-100, #f5f5f5);
    --wf-muted: var(--color-gray-400, #a1a1a1);
    --wf-border: var(--color-gray-700, #333333);
    --wf-hover: var(--color-gray-800, #262626);
  }
}

:root.dark {
  color-scheme: dark;
  --wf-bg: var(--color-gray-950, #121212);
  --wf-surface: var(--color-gray-900, #1a1a1a);
  --wf-fg: var(--color-gray-100, #f5f5f5);
  --wf-muted: var(--color-gray-400, #a1a1a1);
  --wf-border: var(--color-gray-700, #333333);
  --wf-hover: var(--color-gray-800, #262626);
}

body {
  margin: 0;
  padding: 16px;
  background: var(--wf-bg);
  color: var(--wf-fg);
  font-family: var(--wf-font);
  font-size: 0.875rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 12px;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}
h1 {
  font-size: 1.375rem;
}
h2 {
  font-size: 1.125rem;
}
h3 {
  font-size: 1rem;
}
h4 {
  font-size: 0.9375rem;
}

p {
  margin: 0 0 12px;
}

small,
.wf-muted {
  color: var(--wf-muted);
  font-size: 0.8125rem;
}

a {
  color: var(--wf-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

hr {
  border: 0;
  border-top: 1px solid var(--wf-border);
  margin: 16px 0;
}

ul,
ol {
  margin: 0 0 12px;
  padding-left: 20px;
}
li {
  margin: 4px 0;
}
/* A list used as a row list rather than prose: the page opts in. */
ul.wf-rows {
  list-style: none;
  padding: 0;
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
}
ul.wf-rows > li {
  margin: 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--wf-border);
}
ul.wf-rows > li:first-child {
  border-top: 0;
}

code,
kbd,
samp {
  font-family: var(--wf-mono);
  font-size: 0.8125rem;
}
code {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: 4px;
  padding: 1px 4px;
}
pre {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 10px 12px;
  overflow-x: auto;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
th,
td {
  border-bottom: 1px solid var(--wf-border);
  padding: 6px 10px;
  text-align: left;
}
th {
  color: var(--wf-muted);
  font-weight: 500;
  font-size: 0.8125rem;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: var(--wf-bg);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 5px 8px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--wf-accent);
  outline-offset: 1px;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--wf-accent);
  padding: 0;
}

button {
  font: inherit;
  font-weight: 500;
  color: inherit;
  background: var(--wf-bg);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 5px 10px;
  cursor: pointer;
  transition: background-color 150ms;
}
button:hover:not(:disabled) {
  background: var(--wf-hover);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
button.wf-primary {
  background: var(--wf-accent);
  border-color: var(--wf-accent);
  color: var(--wf-accent-fg);
}
button.wf-primary:hover:not(:disabled) {
  background: var(--wf-accent);
  opacity: 0.9;
}

.wf-card {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 12px;
}

.wf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}