Build the interface.
The shell before the logic.
In this stage, you build the visual shell of the CRM: a sidebar, a header, a row of KPI cards, and a customer table. No JavaScript yet. No data yet. Just the layout, the typography, and the dark theme — using CSS Grid for the outer structure and Flexbox for the inner. This is the foundation everything else attaches to.
Short answer: A single HTML file with inline CSS. A CSS Grid shell (sidebar + header + main). Dark-theme colors as CSS custom properties on :root. A sidebar with navigation groups. A header with search and an action button. Four KPI cards using Grid. A customer table using a plain <table>. One responsive breakpoint that collapses the sidebar on mobile. All the code is on this page — copy it, read it, or download the file at the end.
✅ What you'll build
The visual shell — no logic yet.
Sidebar
240px fixed width. Brand mark, three nav groups (Overview, Activity, Settings). Active state on the current page.
Header
64px height. Page title, search box, "Add customer" button, user avatar. Flexbox for alignment.
KPI cards
Four cards. Total customers, active leads, pipeline value, won this quarter. Each with a value and a delta indicator.
Customer table
Five rows of sample data. Name, company, email, status (with colored badges), added date.
Don't skip this stage to get to JavaScript faster. Stage 02 is easier when the layout is done. If you try to build both at once, you'll rewrite the HTML three times as the JS forces layout changes. The interface is the stable foundation — get it right, then attach the logic.
✅ The Grid layout
CSS Grid expresses the shell in six lines.
.crm-shell {
display: grid;
grid-template-columns: 240px 1fr;
grid-template-rows: 64px 1fr;
grid-template-areas:
"sidebar header"
"sidebar main";
min-height: 100vh;
}
.crm-sidebar { grid-area: sidebar; }
.crm-header { grid-area: header; }
.crm-main { grid-area: main; }
The layout in words:
┌─────────┬───────────────────────┐
│ │ header │ 64px
│ sidebar ├───────────────────────┤
│ 240px │ │
│ │ main │ 1fr
│ │ │
└─────────┴───────────────────────┘
Three named areas:
sidebar — left column, spans both rows
header — top right, fixed height
main — bottom right, fills remaining space
Each child is assigned to its area with grid-area.
Why this is better than flexbox:
Flexbox would need:
.shell { display: flex }
.sidebar { width: 240px }
.content { flex: 1; display: flex; flex-direction: column }
.header { height: 64px }
.main { flex: 1 }
Grid is:
.shell { display: grid; grid-template: ...; grid-template-areas: ... }
One declaration. Named areas. No wrappers.
And grid-areas self-document the layout.
You read the CSS and see the layout.
✅ Design tokens
Every color is a custom property. Change one, change everywhere.
:root {
/* Backgrounds */
--bg: #0f172a;
--bg-elevated: #1e293b;
--bg-hover: #334155;
/* Borders and text */
--border: #334155;
--text: #e2e8f0;
--text-muted: #94a3b8;
--text-dim: #64748b;
/* Brand and status */
--accent: #61dafb;
--accent-dark: #0891b2;
--success: #10b981;
--warning: #f59e0b;
--danger: #ef4444;
/* Layout */
--radius: 8px;
--sidebar-width: 240px;
--header-height: 64px;
}
Why tokens matter:
1. Single source of truth
The accent color appears in
buttons, active nav items,
focus rings, links.
One variable. Change once.
All update.
2. Dark mode is free
Define tokens on :root,
override on [data-theme="dark"]
or @media (prefers-color-scheme).
Every component follows.
3. Consistency at scale
With 20 colors hardcoded,
5 will drift. With 20 tokens,
they can't.
4. Designers and developers
share the same vocabulary
"the elevated background"
"the muted text"
Not "that gray".
The naming convention:
--bg-* — backgrounds
--text-* — text colors
--border — borders
--accent-* — brand colors
--success — positive states
--warning — caution states
--danger — error states
--{size} — layout dimensions
This is the same pattern used by
Tailwind, Radix, shadcn/ui, and every
serious design system.
✅ Responsive breakpoints
Two breakpoints. The sidebar collapses, then the KPI grid stacks.
@media (max-width: 900px) {
.crm-kpi-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 768px) {
.crm-shell {
grid-template-columns: 1fr;
grid-template-rows: auto var(--header-height) 1fr;
grid-template-areas:
"header"
"header"
"main";
}
.crm-sidebar { display: none; }
.crm-header { padding: 0 1rem; }
.crm-main { padding: 1rem; }
}
@media (max-width: 500px) {
.crm-kpi-grid { grid-template-columns: 1fr; }
.crm-table th:nth-child(3),
.crm-table td:nth-child(3) { display: none; }
}
Desktop (>768px): ┌─────────┬───────────────────┐ │ │ header │ │ sidebar ├───────────────────┤ │ │ KPI KPI KPI KPI │ │ │ ┌─────────────┐ │ │ │ │ table │ │ │ │ └─────────────┘ │ └─────────┴───────────────────┘ Tablet (768px): KPI cards collapse to 2 columns. Mobile (768px): Sidebar is hidden. Header spans full width. Main takes the rest. ┌─────────────────────────┐ │ header │ ├─────────────────────────┤ │ KPI KPI │ │ KPI KPI │ │ ┌───────────────────┐ │ │ │ table │ │ │ └───────────────────┘ │ └─────────────────────────┘ Small mobile (500px): KPI cards stack to 1 column. Email column is hidden (it's the least important for a glance on a phone). Why hide the sidebar instead of turning it into a bottom nav or hamburger menu? Because that's a decision for Stage 02 or a future iteration. The shell's job is to prove the layout works. A mobile navigation pattern is its own project. The rule: don't over-engineer the shell. Ship the responsive shell. Add navigation patterns when you need them.
✅ The full file
The complete Stage 01 code, ready to run.
The complete file is at /apps/crm/downloads/crm-stage-01.html. It's the same file the previous section described, fully assembled. Open it in a browser to see it render. Open it in a text editor to read it.
Right-click, save link as. Or open in a new tab and use File → Save Page.
Zero dependencies
No Tailwind, no Font Awesome, no external fonts. Everything inline. The file works offline.
Semantic HTML
<aside>, <header>, <main>, <table> with <thead> and <tbody>. Not divs.
Accessible by default
Search input has a label. Table has headers. Buttons are real buttons. Nav links have clear text.
Customizable
Change the tokens. Change the layout. It's your CRM shell now.
⚠️ Common mistakes
What to check if the layout doesn't render right.
min-height: 100vh on the shellThe grid collapses to its content height. Fix: min-height: 100vh on .crm-shell.
grid-area nameElement doesn't appear where expected. Fix: names must match exactly between grid-template-areas and grid-area.
Grid-areas handles this automatically when the name appears twice. Fix: ensure "sidebar" is in both rows of the template.
:root on the tokensCSS variables undefined. Fix: wrap the token block in :root { ... }.
height instead of min-height for the shellContent taller than the viewport is clipped. Fix: min-height.
Because the media query targets the wrong selector. Fix: @media (max-width: 768px) { .crm-sidebar { display: none; } }.
Different number of cells in the header vs body rows. Fix: every <tr> has the same number of <td> or <th>.
Grid cells don't stretch content by default. Fix: align-items: stretch on the grid (which is the default for grid, so check that grid-auto-rows or explicit rows aren't overriding).
❓ Frequently asked
What will I build in Stage 01?
A static CRM dashboard interface — the visual shell. It includes a sidebar with navigation, a header with a search box and an "Add customer" button, a row of four KPI cards (Total customers, Active leads, Pipeline value, Won this quarter), and a table showing five sample customers. The result is a single HTML file with inline CSS. No JavaScript yet — that's Stage 02.
Why start with the interface and not the logic?
Because logic needs a place to live. If you try to build a working app before you have the layout, you end up rewriting the layout when the logic forces changes. Building the shell first means Stage 02 can focus entirely on JavaScript state, rendering, and events — the parts that are actually hard to learn.
Why CSS Grid instead of Flexbox for the layout?
The CRM is a two-dimensional layout: a fixed-width sidebar and a flexible main area, plus a header that spans the top. CSS Grid expresses this in one declaration with named areas. Flexbox would require nested containers. Grid is the right tool for the outer structure. Flexbox is the right tool for the inner structure — the KPI row, the header actions, the table cells. You use both.
Do I need any tools or dependencies?
No. Stage 01 is a single HTML file with inline CSS. It opens in any browser. No npm, no build step, no framework, no server. If you have a text editor and a browser, you have everything you need.
Can I customize the design?
Yes — and you should. Every color is a CSS custom property at the top of the file (--bg, --text, --accent, --success, --warning, --danger). Change those and the whole design updates. The spacing uses a small set of variables. The layout uses named grid areas. Change any of these and the design follows.
What if I get stuck?
Download the complete file from the link at the end of this page and compare it line-by-line with your version. The file is tested and works. If your version looks different, the difference is in the HTML structure or the CSS rules — the browser DevTools (F12) will show you which CSS is applying. The most common issues are: forgetting to set the CSS custom properties on :root, a typo in a grid-area name, or a missing closing tag.
🔗 Continue learning
Or explore related CSS concepts: