04 · Structure
Layout
Two kinds of surfaces, one system. Marketing and brand surfaces are dark-first — navy, atmospheric, editorial. Internal apps are light-first — white surfaces anchored by the navy gradient sidebar — with an official dark mode the user can switch on. This page is the canonical, framework-independent standard for the internal-app shell.
The shell
Anatomy of a DiffLab app
Every internal app is the same three regions: a 240px fixed gradient sidebar, a 56px white header with breadcrumbs, and a scrollable content area. This is the canonical DiffLab app shell (from the enterprise-workflows template) — it supersedes any legacy app style.
(2rem at ≥ 1024px)
grid-template-columns: 240px 1fr — the sidebar spans both rows; only the content scrolls.
Live reference
See it running
A complete, self-contained implementation — no framework, no build step, just the tokens file and one HTML page. Copy it as the starting point for any new internal app.
Specification
The numbers
Every value below is normative and available as a
--dl-* token in
tokens.json /
tokens.css.
Sidebar
| Property | Value | Token |
|---|---|---|
| Width | 240px, fixed |
--dl-layout-sidebar-width |
| Background | linear-gradient(167deg, #1A2744 0%, #0B1224 100%) |
--dl-color-app-sidebar-gradient |
| Text | rgba(255,255,255,0.84) |
--dl-color-app-sidebar-text |
| Text, muted / section labels | rgba(255,255,255,0.55) |
--dl-color-app-sidebar-text-muted |
| Active item background | rgba(255,255,255,0.08) (white @ 8%) — never an amber tint; amber over navy turns brown |
--dl-color-app-sidebar-active-bg |
| Active item indicator | inset 2px amber-bright left bar (box-shadow: inset 2px 0 0 #FBBF24); text and icon white (--dl-color-app-sidebar-text-active). Exactly one item is active — parents of the active page and expanded groups get no fill and no amber. |
--dl-color-app-sidebar-active-indicator |
| Brand block | the mark rendered white at the top; user block pinned to the bottom | — |
Header & content
| Property | Value | Token |
|---|---|---|
| Header height | 56px (3.5rem) |
--dl-layout-header-height |
| Header treatment | header surface (white in light, raised navy in dark), 1px bottom hairline, breadcrumbs left / actions right | --dl-app-header-bg, --dl-app-border |
| Content padding | 1.5rem |
--dl-layout-content-pad |
| Content padding, ≥ 1024px | 2rem |
--dl-layout-content-pad-lg |
| Page background | #FFFFFF light / #0E1525 dark; cards sit on it as --dl-app-surface panels with hairline borders |
--dl-app-bg |
Text ramp
| Role | Light | Dark | Token |
|---|---|---|---|
| Strong — headings, primary data | #111827 |
#EDF2F9 |
--dl-app-text-1 |
| Muted — labels, descriptions | #4B5563 |
#A9B4C8 |
--dl-app-text-2 |
| Faint — placeholders, tertiary | #6B7280 |
#8391A8 |
--dl-app-text-3 |
Type conventions
| Convention | Value |
|---|---|
| Root font size | html { font-size: 106.25% } — 17px at the browser default |
| Line height | 1.55 for app UI text |
| Families | Inter for UI, Space Grotesk for headings, JetBrains Mono for code, IDs, and eyebrow labels |
| Numerals | font-variant-numeric: tabular-nums in every data table and stat |
Radii
| Element | Radius | Token |
|---|---|---|
| Card | 0.75rem (padding 1.25–1.5rem) | --dl-radius-card |
| Button | 0.375rem | --dl-radius-button |
| StatusBadge | 9999px (pill) | --dl-radius-badge |
Buttons — 4 variants
| Variant | Background | Text | Hover |
|---|---|---|---|
| Primary | amber #F59E0B |
navy #1A2744 (6.9:1) |
amber-bright #FBBF24 |
| Secondary | white, 1px border | #111827 |
border darkens to #6B7280 |
| Ghost | transparent | #4B5563 |
faint gray fill |
| Danger | #DC2626 |
white | #B91C1C |
Buttons — 3 sizes
| Size | Padding | Font size |
|---|---|---|
| sm | 0.3rem 0.7rem | 0.75rem |
| md (default) | 0.45rem 0.95rem | 0.85rem |
| lg | 0.6rem 1.25rem | 0.95rem |
Status badges
| Status | Foreground | Background |
|---|---|---|
| Success | #0F7A0A | #E4FFEC |
| Error | #B91C1C | #FEE2E2 |
| Warning | #B45309 | #FEF3C7 |
| Info | #005FCC | #E0F2FF |
These are the light values. Consume the pairs as
--dl-app-status-*-fg/bg and each pair flips together in
dark mode — the full light/dark table lives in the
Dark mode section below.
Recipes
Component recipes
Framework-free snippets — plain HTML and CSS over the tokens. Port them to React, Vue, or whatever your app uses; the numbers are what matter.
Card
App surface on the app background — white on white-with-hairlines in light, raised navy in dark. Radius 0.75rem, padding 1.25–1.5rem, hairline border.
<div class="card">…</div>
.card {
background: var(--dl-app-surface); /* #FFFFFF light · #151E33 dark */
border: 1px solid var(--dl-app-border); /* #E5E7EB light · #2B3854 dark */
border-radius: var(--dl-radius-card); /* 0.75rem */
padding: 1.25rem; /* 1.5rem for roomy cards */
}
Button
Radius 0.375rem, weight 600. Variants: primary, secondary, ghost, danger. Sizes: sm, md, lg.
<button class="btn btn--primary btn--md">New run</button>
.btn {
display: inline-flex;
align-items: center;
gap: 0.45em;
border: 1px solid transparent;
border-radius: var(--dl-radius-button); /* 0.375rem */
font: 600 0.85rem/1.2 var(--dl-font-family-sans);
cursor: pointer;
}
.btn--sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.btn--md { padding: 0.45rem 0.95rem; font-size: 0.85rem; }
.btn--lg { padding: 0.6rem 1.25rem; font-size: 0.95rem; }
/* primary + danger are theme-invariant; secondary + ghost flip via tokens */
.btn--primary { background: var(--dl-color-brand-amber); /* #F59E0B */
color: var(--dl-color-brand-navy); } /* hover amber-bright #FBBF24 */
.btn--secondary { background: var(--dl-app-surface);
color: var(--dl-app-text-1);
border-color: var(--dl-app-border); }
.btn--ghost { background: transparent;
color: var(--dl-app-text-2); }
.btn--danger { background: var(--dl-color-brand-destructive); /* #DC2626 */
color: #fff; } /* hover #B91C1C */
StatusBadge
Pill (radius 9999px): soft background, strong foreground. Four statuses only. The pairs flip together in dark mode.
<span class="badge badge--success">Succeeded</span>
.badge {
display: inline-flex;
padding: 0.15rem 0.6rem;
border-radius: var(--dl-radius-badge); /* 9999px */
font-size: 0.72rem;
font-weight: 600;
}
.badge--success { color: var(--dl-app-status-success-fg); background: var(--dl-app-status-success-bg); }
.badge--error { color: var(--dl-app-status-error-fg); background: var(--dl-app-status-error-bg); }
.badge--warning { color: var(--dl-app-status-warning-fg); background: var(--dl-app-status-warning-bg); }
.badge--info { color: var(--dl-app-status-info-fg); background: var(--dl-app-status-info-bg); }
SectionHeader
Title and description on the left, primary action on the right. One per content section.
<div class="section-header">
<div>
<h2>Workflow Runs</h2>
<p>Every execution across your pipelines.</p>
</div>
<button class="btn btn--primary btn--md">New run</button>
</div>
.section-header {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1.5rem;
}
.section-header h2 {
font: 700 1.375rem/1.2 var(--dl-font-family-display);
letter-spacing: -0.03em;
color: var(--dl-app-text-1);
margin: 0;
}
.section-header p { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--dl-app-text-2); }
Dark mode
Same shell, flipped tokens
Internal apps have one official dark theme. It is not a redesign
and not a per-app decision — it is the --dl-app-*
semantic tokens resolving to different values, using the exact
mechanism this site uses: a data-theme attribute on
<html>, a prefers-color-scheme
fallback, and a persisted user choice.
- Light stays the default. Apps are light-first; dark is a user setting. First visit renders light — never dark, regardless of the OS. The user cycles light → dark → auto; only “auto” follows the OS.
-
The sidebar never changes. The 240px navy
gradient sidebar is theme-invariant — pixel-identical in both
themes. It is the brand anchor; it is already dark. It uses the
--dl-color-app-sidebar-*primitives, which never flip. -
Components consume semantic tokens only.
No component defines a dark variant or hardcodes a color. Style
with
--dl-app-*and dark mode is automatic — for your components and for every future theme adjustment.
The tokens, both themes
Every --dl-app-* token, normative in
tokens.json /
tokens.css. Light values live in
:root; dark values apply under
[data-theme="dark"] and, for “auto”, under
@media (prefers-color-scheme: dark) when no explicit
theme is set.
| Token | Role | Light | Dark |
|---|---|---|---|
--dl-app-bg |
Page background | #FFFFFF |
hsl(221 45% 10%) ≈ #0E1525 |
--dl-app-surface |
Cards, panels | #FFFFFF |
hsl(221 42% 14%) ≈ #151E33 |
--dl-app-surface-raised |
Row hover, nested / raised surfaces | #F8FAFC |
hsl(221 40% 18%) ≈ #1C2740 |
--dl-app-border |
Hairlines, dividers | #E5E7EB |
hsl(221 32% 25%) ≈ #2B3854 |
--dl-app-text-1 |
Strong text | #111827 |
#EDF2F9 |
--dl-app-text-2 |
Muted text | #4B5563 |
#A9B4C8 |
--dl-app-text-3 |
Faint text | #6B7280 |
#8391A8 |
--dl-app-header-bg |
Header surface | #FFFFFF |
hsl(221 42% 14%) ≈ #151E33 |
--dl-app-link |
Links, functional blue | #006CD1 |
#4DA6FF |
--dl-app-status-success-fg |
Success foreground | #0F7A0A |
#4ADE80 |
--dl-app-status-success-bg |
Success background | #E4FFEC |
#0C2B1C |
--dl-app-status-error-fg |
Error foreground | #B91C1C |
#F87171 |
--dl-app-status-error-bg |
Error background | #FEE2E2 |
#361318 |
--dl-app-status-warning-fg |
Warning foreground | #B45309 |
#FBBF24 |
--dl-app-status-warning-bg |
Warning background | #FEF3C7 |
#33250B |
--dl-app-status-info-fg |
Info foreground | #005FCC |
#5CACFF |
--dl-app-status-info-bg |
Info background | #E0F2FF |
#0D2440 |
The recipe — copy all three pieces
1 · A FOUC-safe snippet in <head>,
before any stylesheet, applies the persisted choice pre-paint.
Apps persist to localStorage "dl-app-theme"
(the brand site itself uses "dl-theme", so an app
and this guide never fight over the key).
<!-- in <head>, BEFORE any <link rel="stylesheet"> -->
<script>
(function () {
var m = "light"; /* apps are light-first */
try { m = localStorage.getItem("dl-app-theme") || "light"; } catch (e) {}
if (m === "light" || m === "dark") {
document.documentElement.setAttribute("data-theme", m);
}
/* "auto" sets NO attribute — the prefers-color-scheme
block in tokens.css follows the OS. */
})();
</script>
<link rel="stylesheet" href="/tokens/tokens.css">
2 · The toggle — one button, ~15 lines, cycle light → dark → auto:
<button id="theme-toggle" type="button">◐ light</button>
<script>
var MODES = ["light", "dark", "auto"];
function applyTheme(mode) {
var root = document.documentElement;
if (mode === "auto") root.removeAttribute("data-theme");
else root.setAttribute("data-theme", mode);
try { localStorage.setItem("dl-app-theme", mode); } catch (e) {}
document.getElementById("theme-toggle").textContent = "◐ " + mode;
}
document.getElementById("theme-toggle").addEventListener("click", function () {
var m = "light";
try { m = localStorage.getItem("dl-app-theme") || "light"; } catch (e) {}
applyTheme(MODES[(MODES.indexOf(m) + 1) % MODES.length]);
});
</script>
3 · The consumption pattern — components style with semantic tokens and never mention dark mode:
/* every color is a semantic token — dark mode is automatic */
body { background: var(--dl-app-bg); color: var(--dl-app-text-1); }
.header { background: var(--dl-app-header-bg);
border-bottom: 1px solid var(--dl-app-border); }
.card { background: var(--dl-app-surface);
border: 1px solid var(--dl-app-border); }
a { color: var(--dl-app-link); }
.badge--success { color: var(--dl-app-status-success-fg);
background: var(--dl-app-status-success-bg); }
/* the ONE exception: the sidebar consumes the theme-invariant
primitives, so it renders identically in both themes */
.sidebar { background: var(--dl-color-app-sidebar-gradient); }
/* native controls (inputs, scrollbars) follow the theme too */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) { color-scheme: dark; }
}
- Consume
--dl-app-*semantic tokens for every surface, border, text, link, and status color. - Ship light as the first-visit default; expose dark and auto as a user setting.
- Keep the navy gradient sidebar identical in both themes — it is already dark.
- Set
color-schemeso native controls and scrollbars follow along.
- Don’t hand-pick per-component dark hex values — if a color isn’t a token, it doesn’t belong in an app.
- Don’t invert, lighten, or restyle the sidebar in dark mode.
- Don’t default new apps to dark or to the OS preference — “auto” is an opt-in.
- Don’t ship a second “dark stylesheet” — one CSS file, tokens flip.
See it live: the demo Console has this exact toggle in its header (the ◐ button) — flip it and watch every component follow while the sidebar holds still. The demo’s source is the reference implementation of everything above.