diff --git a/packages/ui/src/ThemeSwitcher.tsx b/packages/ui/src/ThemeSwitcher.tsx index 1ca5bba..7cf9cc0 100644 --- a/packages/ui/src/ThemeSwitcher.tsx +++ b/packages/ui/src/ThemeSwitcher.tsx @@ -2,6 +2,7 @@ import { useState } from 'react' import { ACCENTS, getAccent, getThemeMode, setAccent, setThemeMode, type Accent } from './theme' const SWATCH: Record = { + teal: '#115e59', indigo: '#4f5df0', blue: '#2f7ce8', emerald: '#14957a', diff --git a/packages/ui/src/theme.ts b/packages/ui/src/theme.ts index 674a955..8bc8dfb 100644 --- a/packages/ui/src/theme.ts +++ b/packages/ui/src/theme.ts @@ -5,7 +5,7 @@ */ export type ThemeMode = 'light' | 'dark' -export const ACCENTS = ['indigo', 'blue', 'emerald', 'violet', 'rose', 'amber'] as const +export const ACCENTS = ['teal', 'indigo', 'blue', 'emerald', 'violet', 'rose', 'amber'] as const export type Accent = (typeof ACCENTS)[number] const MODE_KEY = 'ui.themeMode' @@ -17,7 +17,7 @@ export function getThemeMode(): ThemeMode { export function getAccent(): Accent { const stored = localStorage.getItem(ACCENT_KEY) - return (ACCENTS as readonly string[]).includes(stored ?? '') ? (stored as Accent) : 'indigo' + return (ACCENTS as readonly string[]).includes(stored ?? '') ? (stored as Accent) : 'teal' } export function setThemeMode(mode: ThemeMode): void { diff --git a/packages/ui/src/tokens.css b/packages/ui/src/tokens.css index 078abd2..92f1707 100644 --- a/packages/ui/src/tokens.css +++ b/packages/ui/src/tokens.css @@ -1,8 +1,8 @@ /* ================================================================ - SiMS Next design system — premium, themeable, offline-safe. - References: Stripe Dashboard (light clarity), Linear (dark, crisp - hairlines), Notion (neutral warmth). Fonts are bundled (Inter - Variable + JetBrains Mono Variable) — shop fonts are never trusted. + SiMS HQ design system — warm ops-console (spec 2026-07-17). + Direction A v2 discipline (flat, border-defined, ink primary, + accent-for-state) wearing the H-04 warm palette + teal accent. + Fonts are bundled (Inter Variable + JetBrains Mono Variable). Mode + accent apply via (theme.ts). Class names are stable: restyling here restyles every screen. ================================================================ */ @@ -11,17 +11,20 @@ --font: 'Inter Variable', 'Segoe UI', system-ui, -apple-system, sans-serif; --mono: 'JetBrains Mono Variable', 'Cascadia Mono', Consolas, monospace; - --radius: 8px; - --radius-lg: 14px; + --radius-sm: 4px; + --radius: 6px; + --radius-lg: 10px; --pad: 12px; --speed: 140ms; - --shadow-sm: 0 1px 2px rgba(16, 20, 28, 0.06); - --shadow-md: 0 2px 8px rgba(16, 20, 28, 0.08), 0 1px 2px rgba(16, 20, 28, 0.05); - --shadow-lg: 0 16px 48px rgba(16, 20, 28, 0.22), 0 4px 12px rgba(16, 20, 28, 0.1); + /* Flat by default: resting surfaces are border-defined, not shadowed. */ + --shadow-sm: none; + --shadow-md: 0 1px 2px rgba(20, 18, 12, 0.05); + --shadow-lg: 0 16px 48px rgba(20, 18, 12, 0.22), 0 4px 12px rgba(20, 18, 12, 0.1); } -/* ---- accents (option to change colour) ---- */ +/* ---- accents (accent paints STATE — active nav, chips, links, focus) ---- */ +[data-accent='teal'] { --accent: #115e59; --accent-strong: #0d4f4a; --accent-contrast: #ffffff; } [data-accent='indigo'] { --accent: #4f5df0; --accent-strong: #3f4cd9; --accent-contrast: #ffffff; } [data-accent='blue'] { --accent: #2f7ce8; --accent-strong: #2368ca; --accent-contrast: #ffffff; } [data-accent='emerald'] { --accent: #14957a; --accent-strong: #0f7f68; --accent-contrast: #ffffff; } @@ -29,52 +32,59 @@ [data-accent='rose'] { --accent: #d4497c; --accent-strong: #bb3a6a; --accent-contrast: #ffffff; } [data-accent='amber'] { --accent: #b97e10; --accent-strong: #a06a08; --accent-contrast: #ffffff; } -/* ---- light (default): Stripe-like clarity ---- */ +/* ---- light (default): warm paper ---- */ :root, [data-theme='light'] { - --bg: #f6f7f9; + --bg: #fafaf7; --bg-raised: #ffffff; - --bg-hover: #f0f2f5; - --bg-inset: #eef0f3; - --border: #e4e7ec; - --border-strong: #d4d9e0; - --text: #1a1f27; - --text-dim: #667084; - --ok: #147a52; - --warn: #9a6700; - --err: #c93a3a; + --bg-hover: #f2f1ec; + --bg-inset: #f2f1ec; + --border: #e7e5de; + --border-strong: #d6d4cc; + --text: #1a1a17; + --text-dim: #6b6a62; + --ok: #047857; + --warn: #a8702b; + --err: #a64242; --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--bg-raised)); - --ok-soft: #e5f5ec; - --warn-soft: #fcf3dc; - --err-soft: #fdecec; - --scrollbar: #c9cfd8; + --ok-soft: #e2f4eb; + --warn-soft: #faf1e0; + --err-soft: #f6e5e5; + --scrollbar: #d6d4cc; color-scheme: light; } -/* ---- dark: Linear-like depth ---- */ +/* ---- dark: warm night ---- */ [data-theme='dark'] { - --bg: #0e1116; - --bg-raised: #161a21; - --bg-hover: #1e242e; - --bg-inset: #0a0d11; - --border: #262c37; - --border-strong: #333b49; - --text: #e8ecf1; - --text-dim: #8b95a6; + --bg: #131210; + --bg-raised: #1b1a17; + --bg-hover: #242320; + --bg-inset: #0e0d0b; + --border: #2b2a25; + --border-strong: #3a3830; + --text: #eae8e2; + --text-dim: #a8a69c; --ok: #43c288; --warn: #e6b23e; --err: #ef6a63; - --accent: color-mix(in srgb, var(--accent-strong) 20%, #7c8cff); --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--bg-raised)); --ok-soft: color-mix(in srgb, #43c288 14%, var(--bg-raised)); --warn-soft: color-mix(in srgb, #e6b23e 14%, var(--bg-raised)); --err-soft: color-mix(in srgb, #ef6a63 14%, var(--bg-raised)); - --scrollbar: #333b49; - --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35); - --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.4); + --scrollbar: #3a3830; + --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6); color-scheme: dark; } +/* Dark-mode accents: explicit lighter values so every accent stays itself. */ +[data-theme='dark'][data-accent='teal'] { --accent: #2da89a; --accent-strong: #22897d; } +[data-theme='dark'][data-accent='indigo'] { --accent: #7c8cff; --accent-strong: #6675f0; } +[data-theme='dark'][data-accent='blue'] { --accent: #66a3f2; --accent-strong: #4a8ce0; } +[data-theme='dark'][data-accent='emerald'] { --accent: #35b795; --accent-strong: #279c7e; } +[data-theme='dark'][data-accent='violet'] { --accent: #a97ff0; --accent-strong: #9367e0; } +[data-theme='dark'][data-accent='rose'] { --accent: #e57ba3; --accent-strong: #d4608c; } +[data-theme='dark'][data-accent='amber'] { --accent: #d9a247; --accent-strong: #c08a2e; } + /* ================= base ================= */ * { box-sizing: border-box; } html, body, #root { height: 100%; margin: 0; } @@ -90,13 +100,20 @@ h1, h2, h3 { letter-spacing: -0.015em; font-weight: 600; } ::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); } :focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; } * { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; } -@media (prefers-reduced-motion: reduce) { * { transition: none !important; } } +@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } } +/* Money and quantities: Inter with tabular figures. */ .num { font-family: var(--font); font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.005em; } +/* Machine data: codes, doc numbers, GSTINs, ids. */ +.mono { + font-family: var(--mono); + font-size: 0.93em; + letter-spacing: 0.01em; +} /* ================= controls ================= */ button.wf { @@ -104,44 +121,45 @@ button.wf { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 7px 14px; font: 500 13.5px/1.45 var(--font); cursor: pointer; - box-shadow: var(--shadow-sm); - transition: background var(--speed), border-color var(--speed), box-shadow var(--speed), transform 80ms; + transition: background var(--speed), border-color var(--speed), opacity var(--speed), transform 80ms; } button.wf:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); } -button.wf:active { transform: translateY(1px); box-shadow: none; } +button.wf:active { transform: translateY(1px); } +/* Ink primary — accent is reserved for state, not the main CTA. */ button.wf.primary { - background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent-strong)); - border-color: var(--accent-strong); color: var(--accent-contrast); font-weight: 600; - box-shadow: 0 1px 2px color-mix(in srgb, var(--accent-strong) 45%, transparent); + background: var(--text); color: var(--bg-raised); + border-color: var(--text); font-weight: 600; } -button.wf.primary:hover { filter: brightness(1.06); } +button.wf.primary:hover { opacity: 0.86; background: var(--text); } button.wf.danger { border-color: color-mix(in srgb, var(--err) 55%, var(--border-strong)); color: var(--err); } button.wf.danger:hover { background: var(--err-soft); } button.wf kbd { background: color-mix(in srgb, currentColor 14%, transparent); - border-radius: 4px; padding: 0 5px; margin-left: 8px; + border-radius: var(--radius-sm); padding: 0 5px; margin-left: 8px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; } -input.wf, select.wf { +input.wf, select.wf, textarea.wf { background: var(--bg-raised); color: var(--text); border: 1px solid var(--border-strong); - border-radius: var(--radius); padding: 7px 11px; + border-radius: var(--radius-sm); padding: 7px 11px; font: 400 13.5px/1.45 var(--font); width: 100%; - box-shadow: inset 0 1px 2px rgba(16, 20, 28, 0.04); transition: border-color var(--speed), box-shadow var(--speed); } -input.wf::placeholder { color: var(--text-dim); } -input.wf:focus, select.wf:focus { +input.wf::placeholder, textarea.wf::placeholder { color: var(--text-dim); } +input.wf:focus, select.wf:focus, textarea.wf:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); } /* ================= page scaffolding ================= */ -.wf-page { padding: 24px 28px; max-width: 1400px; } +.wf-page { padding: 20px 24px 32px; max-width: 1400px; } .wf-page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; } -.wf-page-head h1 { font-size: 21px; margin: 0; } +.wf-page-head h1 { font-size: 22px; margin: 0; } .wf-page-desc { color: var(--text-dim); margin: 0 0 18px; max-width: 72ch; } +.wf-crumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-dim); margin: 0 0 6px; } +.wf-crumbs a { color: var(--text-dim); text-decoration: none; } +.wf-crumbs a:hover { color: var(--accent); } .wf-toolbar { display: flex; gap: 8px; align-items: center; margin: 14px 0; flex-wrap: wrap; } .wf-toolbar .spacer { flex: 1; } @@ -149,18 +167,26 @@ input.wf:focus, select.wf:focus { table.wf { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--bg-raised); border: 1px solid var(--border); - border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); + border-radius: var(--radius); overflow: hidden; } table.wf th, table.wf td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); } table.wf tr:last-child td { border-bottom: none; } table.wf th { - background: color-mix(in srgb, var(--bg) 55%, var(--bg-raised)); + position: sticky; top: 0; z-index: 1; + background: var(--bg-inset); color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; } table.wf tbody tr { transition: background var(--speed); } table.wf tbody tr:hover td { background: var(--accent-soft); } table.wf td.num, table.wf th.num { text-align: right; } +table.wf td.mono { font-size: 12.5px; } +table.wf tbody tr.tone-err td { background: var(--err-soft); } +table.wf tbody tr.tone-warn td { background: var(--warn-soft); } +table.wf tbody tr.tone-ok td { background: var(--ok-soft); } +table.wf tbody tr.tone-err:hover td, +table.wf tbody tr.tone-warn:hover td, +table.wf tbody tr.tone-ok:hover td { filter: brightness(0.97); } /* ================= badges ================= */ .wf-badge { @@ -179,31 +205,95 @@ table.wf td.num, table.wf th.num { text-align: right; } .wf-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin: 16px 0; } .wf-stat { background: var(--bg-raised); border: 1px solid var(--border); - border-radius: var(--radius-lg); padding: 16px; - box-shadow: var(--shadow-sm); - transition: box-shadow var(--speed), transform var(--speed), border-color var(--speed); + border-radius: var(--radius); padding: 14px 16px; + transition: border-color var(--speed); } -.wf-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-strong); } -.wf-stat .label { color: var(--text-dim); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; } -.wf-stat .value { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; } -.wf-stat .hint { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; } +.wf-stat:hover { border-color: var(--border-strong); } +.wf-stat .label { color: var(--text-dim); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; } +.wf-stat .value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; } +.wf-stat .hint { color: var(--text-dim); font-size: 12px; margin-top: 3px; } +.wf-stat .hint.ok { color: var(--ok); } +.wf-stat .hint.warn { color: var(--warn); } +.wf-stat .hint.err { color: var(--err); } -/* ================= misc surfaces ================= */ +/* ================= states ================= */ .wf-empty { - border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); - padding: 38px; text-align: center; color: var(--text-dim); margin: 14px 0; + border: 1px dashed var(--border-strong); border-radius: var(--radius); + padding: 32px; text-align: center; color: var(--text-dim); margin: 14px 0; background: color-mix(in srgb, var(--bg-raised) 55%, transparent); } +.wf-skel { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; } +.wf-skel-bar { + height: 13px; border-radius: var(--radius-sm); + background: linear-gradient(90deg, var(--bg-inset) 25%, var(--bg-hover) 50%, var(--bg-inset) 75%); + background-size: 200% 100%; + animation: wf-shimmer 1.4s ease infinite; +} +@keyframes wf-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } } +.wf-error { + border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); + background: var(--err-soft); border-radius: var(--radius); + padding: 14px 16px; margin: 14px 0; + display: flex; align-items: center; gap: 12px; font-size: 13px; +} +.wf-error .msg { flex: 1; color: var(--err); } + +/* ================= filter chips ================= */ +.wf-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } +.wf-chip { + border: 1px solid transparent; background: transparent; color: var(--text-dim); + border-radius: 999px; padding: 4px 12px; font: 500 12.5px var(--font); cursor: pointer; + transition: background var(--speed), color var(--speed), border-color var(--speed); +} +.wf-chip:hover { color: var(--text); background: var(--bg-hover); } +.wf-chip.active { + background: var(--accent-soft); color: var(--accent-strong); + border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; +} +[data-theme='dark'] .wf-chip.active { color: var(--accent); } +.wf-chip .count { opacity: 0.75; margin-left: 5px; font-family: var(--mono); font-size: 11px; } + +/* ================= tabs ================= */ +.wf-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 14px 0 16px; overflow-x: auto; } +.wf-tab { + border: none; background: none; cursor: pointer; white-space: nowrap; + padding: 8px 12px 9px; font: 500 13.5px var(--font); color: var(--text-dim); + border-bottom: 2px solid transparent; margin-bottom: -1px; + transition: color var(--speed), border-color var(--speed); +} +.wf-tab:hover { color: var(--text); } +.wf-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); } +.wf-tab .count { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-left: 6px; } + +/* ================= record header ================= */ +.wf-rec { display: flex; gap: 14px; align-items: flex-start; margin: 2px 0 6px; } +.wf-avatar { + width: 44px; height: 44px; border-radius: var(--radius); + display: flex; align-items: center; justify-content: center; + font-weight: 600; font-size: 16px; flex-shrink: 0; +} +.wf-rec-body { min-width: 0; flex: 1; } +.wf-rec-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } +.wf-rec-title h1 { font-size: 22px; margin: 0; } +.wf-rec-meta { color: var(--text-dim); font-size: 13px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } +.wf-rec-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } + +/* ================= misc surfaces ================= */ +.wf-card { + background: var(--bg-raised); border: 1px solid var(--border); + border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; +} +.wf-card > h3:first-child { margin-top: 0; } .wf-field { margin-bottom: 13px; } .wf-field > label { - display: block; color: var(--text-dim); font-size: 12px; font-weight: 550; - margin-bottom: 5px; letter-spacing: 0.01em; + display: block; color: var(--text-dim); font-size: 11px; font-weight: 600; + text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; } .wf-modal-back { - position: fixed; inset: 0; background: rgba(10, 13, 18, 0.45); - backdrop-filter: blur(5px); + position: fixed; inset: 0; background: rgba(15, 14, 11, 0.45); + backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; } .wf-modal { @@ -217,12 +307,49 @@ table.wf td.num, table.wf th.num { text-align: right; } .wf-notice { border-radius: var(--radius); padding: 9px 13px; margin: 10px 0; border: 1px solid var(--border); background: var(--bg-raised); - font-size: 13px; box-shadow: var(--shadow-sm); + font-size: 13px; } .wf-notice.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); } .wf-notice.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); } .wf-notice.err { border-color: color-mix(in srgb, var(--err) 35%, transparent); background: var(--err-soft); } +/* ================= command palette ================= */ +.wf-palette-back { + position: fixed; inset: 0; background: rgba(15, 14, 11, 0.4); + backdrop-filter: blur(3px); z-index: 60; + display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; +} +.wf-palette { + width: 640px; max-width: calc(100vw - 32px); + background: var(--bg-raised); border: 1px solid var(--border); + border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; +} +.wf-palette input { + width: 100%; border: none; outline: none; background: transparent; color: var(--text); + padding: 14px 16px; font: 400 15px var(--font); + border-bottom: 1px solid var(--border); +} +.wf-palette-list { max-height: 46vh; overflow-y: auto; padding: 6px; } +.wf-palette-group { + font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; + color: var(--text-dim); padding: 8px 10px 4px; +} +.wf-palette-item { + display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; + border: none; background: none; cursor: pointer; color: var(--text); + padding: 8px 10px; border-radius: var(--radius); font: 400 13.5px var(--font); +} +.wf-palette-item .hint { color: var(--text-dim); font-size: 12px; margin-left: auto; } +.wf-palette-item.sel { background: var(--accent-soft); } +.wf-palette-foot { + border-top: 1px solid var(--border); padding: 7px 12px; + display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); +} +.wf-palette-foot kbd { + font-family: var(--mono); font-size: 10px; border: 1px solid var(--border-strong); + border-radius: 3px; padding: 0 4px; margin-right: 4px; +} + /* ================= theme switcher ================= */ .wf-themer { display: flex; align-items: center; gap: 6px; } .wf-themer .swatch {