Design: modernisiertes Erscheinungsbild (Schatten statt schwerer Rahmen, Inter-Schrift, Tag/Nacht/System-Umschalter)

This commit is contained in:
Kundencenter 2026-09-28 11:09:58 +02:00
parent 96df0c334a
commit 2d168ff9cc
5 changed files with 84 additions and 32 deletions

View file

@ -5,6 +5,7 @@ import { usePathname, useRouter } from 'next/navigation';
import { api } from '@/lib/api'; import { api } from '@/lib/api';
import { useSession } from '@/lib/session'; import { useSession } from '@/lib/session';
import { ROLE_LABEL } from '@/components/ui'; import { ROLE_LABEL } from '@/components/ui';
import { ThemeToggle } from '@/components/ThemeToggle';
export default function AppLayout({ children }: { children: ReactNode }) { export default function AppLayout({ children }: { children: ReactNode }) {
const { me, loading, can, reload } = useSession(); const r = useRouter(); const path = usePathname(); const [open, setOpen] = useState(false); const { me, loading, can, reload } = useSession(); const r = useRouter(); const path = usePathname(); const [open, setOpen] = useState(false);
@ -39,11 +40,12 @@ export default function AppLayout({ children }: { children: ReactNode }) {
<div className="spacer" /> <div className="spacer" />
{link('/konto', 'Mein Konto')} {link('/konto', 'Mein Konto')}
<div className="small muted" style={{ padding: '8px 16px' }}>{me.user.name}<br />{me.staffRole ? ROLE_LABEL[me.staffRole] : 'Kunde'}</div> <div className="small muted" style={{ padding: '8px 16px' }}>{me.user.name}<br />{me.staffRole ? ROLE_LABEL[me.staffRole] : 'Kunde'}</div>
<div className="row" style={{ padding: '0 16px' }}><ThemeToggle /></div>
<button className="btn small" onClick={logout}>Abmelden</button> <button className="btn small" onClick={logout}>Abmelden</button>
</nav> </nav>
); );
return (<div className="shell"> return (<div className="shell">
<div className="topbar"><strong>Kundencenter</strong><button className="btn small" aria-expanded={open} onClick={() => setOpen(!open)}>Menü</button></div> <div className="topbar"><strong>Kundencenter</strong><div className="row" style={{ gap: 8 }}><ThemeToggle compact /><button className="btn small" aria-expanded={open} onClick={() => setOpen(!open)}>Menü</button></div></div>
{nav}<main id="main" className="main">{children}</main> {nav}<main id="main" className="main">{children}</main>
</div>); </div>);
} }

View file

@ -1,56 +1,70 @@
/* Designsystem v0: ruhige Flächen, viel Weißraum, eine Akzentfarbe. Light/Dark über prefers-color-scheme + data-theme. */ /* Designsystem v1: klare Flächen, dezente Tiefe (Schatten statt schwerer Rahmen), eine Akzentfarbe.
Hell/Dunkel automatisch über prefers-color-scheme, zusätzlich manuell über [data-theme] umschaltbar (siehe ThemeToggle). */
:root { :root {
--bg: #f7f8fa; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3e8; --text: #16191d; --muted: #5b6470; --bg: #f5f6f9; --surface: #ffffff; --surface-2: #eef0f5; --border: #e3e6ec; --text: #13161c; --muted: #656d7a;
--accent: #2456d6; --accent-contrast: #ffffff; --focus: #2456d6; --accent: #4356e8; --accent-contrast: #ffffff; --focus: #4356e8;
--ok: #17703a; --ok-bg: #e4f5ea; --info: #1d5fa8; --info-bg: #e3effb; --warn: #8a5a00; --warn-bg: #fdf0d2; --err: #a52a2a; --err-bg: #fbe5e5; --lock: #4b5563; --lock-bg: #e8eaee; --ok: #15803d; --ok-bg: #e7f6ec; --info: #1d5fa8; --info-bg: #e6f1fb; --warn: #92660a; --warn-bg: #fdf3dc; --err: #b3261e; --err-bg: #fbeaea; --lock: #4b5563; --lock-bg: #eceef2;
--radius: 12px; --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 1px rgba(16, 24, 40, .04);
--font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --shadow-md: 0 8px 20px rgba(16, 24, 40, .07), 0 2px 6px rgba(16, 24, 40, .05);
--radius: 14px; --radius-sm: 10px; --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px;
--font: var(--font-inter), system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
} }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { @media (prefers-color-scheme: dark) { :root:not([data-theme='light']) {
--bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2b323c; --text: #eceff3; --muted: #9aa5b3; --accent: #7aa2ff; --accent-contrast: #0b1020; --focus: #9db9ff; --bg: #0a0d12; --surface: #12161d; --surface-2: #1a1f28; --border: #262c37; --text: #e8ebf0; --muted: #96a0b0; --accent: #8ea2ff; --accent-contrast: #0a0d12; --focus: #8ea2ff;
--ok: #6fd39a; --ok-bg: #12301f; --info: #8bbcf2; --info-bg: #142a42; --warn: #f0c063; --warn-bg: #3a2c0b; --err: #f29b9b; --err-bg: #3d1717; --lock: #b6bfcb; --lock-bg: #262c35; } } --ok: #6fd39a; --ok-bg: #123321; --info: #8bbcf2; --info-bg: #132a44; --warn: #f0c063; --warn-bg: #3a2c0b; --err: #f2a3a3; --err-bg: #3d1a1a; --lock: #b7c0cc; --lock-bg: #242a33;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow-md: 0 10px 24px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
} }
:root[data-theme='dark'] { :root[data-theme='dark'] {
--bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2b323c; --text: #eceff3; --muted: #9aa5b3; --accent: #7aa2ff; --accent-contrast: #0b1020; --focus: #9db9ff; --bg: #0a0d12; --surface: #12161d; --surface-2: #1a1f28; --border: #262c37; --text: #e8ebf0; --muted: #96a0b0; --accent: #8ea2ff; --accent-contrast: #0a0d12; --focus: #8ea2ff;
--ok: #6fd39a; --ok-bg: #12301f; --info: #8bbcf2; --info-bg: #142a42; --warn: #f0c063; --warn-bg: #3a2c0b; --err: #f29b9b; --err-bg: #3d1717; --lock: #b6bfcb; --lock-bg: #262c35; --ok: #6fd39a; --ok-bg: #123321; --info: #8bbcf2; --info-bg: #132a44; --warn: #f0c063; --warn-bg: #3a2c0b; --err: #f2a3a3; --err-bg: #3d1a1a; --lock: #b7c0cc; --lock-bg: #242a33;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow-md: 0 10px 24px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
} }
* { box-sizing: border-box; } * { box-sizing: border-box; }
html { color-scheme: light dark; } html { color-scheme: light dark; }
body { margin: 0; font: 16px/1.55 var(--font); background: var(--bg); color: var(--text); } body { margin: 0; font: 16px/1.55 var(--font); background: var(--bg); color: var(--text); }
h1 { font-size: 1.6rem; margin: 0 0 var(--s3); letter-spacing: -0.01em; } h2 { font-size: 1.15rem; margin: 0 0 var(--s3); } h3 { font-size: 1rem; margin: 0 0 var(--s2); } body, .btn, .badge, .card, input, select, a, .alert { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 var(--s3); letter-spacing: -0.015em; } h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 var(--s3); } h3 { font-size: 1rem; font-weight: 600; margin: 0 0 var(--s2); }
a { color: var(--accent); } p { margin: 0 0 var(--s3); } .muted { color: var(--muted); } .small { font-size: .875rem; } a { color: var(--accent); } p { margin: 0 0 var(--s3); } .muted { color: var(--muted); } .small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; } :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: var(--s3); top: var(--s3); background: var(--surface); padding: var(--s2) var(--s3); z-index: 10; } .skip { position: absolute; left: -999px; } .skip:focus { left: var(--s3); top: var(--s3); background: var(--surface); padding: var(--s2) var(--s3); z-index: 10; }
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; } .shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.nav { background: var(--surface); border-right: 1px solid var(--border); padding: var(--s4) var(--s3); display: flex; flex-direction: column; gap: var(--s2); } .nav { background: var(--surface); border-right: 1px solid var(--border); padding: var(--s4) var(--s3); display: flex; flex-direction: column; gap: 2px; }
.nav .brand { font-weight: 700; font-size: 1.1rem; padding: 0 var(--s3) var(--s3); } .nav .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; padding: 0 var(--s3) var(--s4); }
.nav a { display: block; padding: 10px var(--s3); border-radius: 8px; color: var(--text); text-decoration: none; } .nav a { display: block; padding: 10px var(--s3); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--surface-2); } .nav a[aria-current='page'] { background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); } .nav a:hover { background: var(--surface-2); }
.nav .group { margin: var(--s3) var(--s3) 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); } .nav a[aria-current='page'] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.nav .group { margin: var(--s3) var(--s3) var(--s1); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.nav .spacer { flex: 1; } .nav .spacer { flex: 1; }
.main { padding: var(--s5) var(--s4); max-width: 1100px; width: 100%; } .main { padding: var(--s5) var(--s4); max-width: 1100px; width: 100%; }
.topbar { display: none; } .topbar { display: none; }
@media (max-width: 800px) { @media (max-width: 800px) {
.shell { grid-template-columns: 1fr; } .nav { display: none; } .nav.open { display: flex; position: fixed; inset: 0 30% 0 0; z-index: 5; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); overflow: auto; } .shell { grid-template-columns: 1fr; } .nav { display: none; } .nav.open { display: flex; position: fixed; inset: 0 30% 0 0; z-index: 5; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: var(--s3); background: var(--surface); border-bottom: 1px solid var(--border); } .topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3); background: var(--surface); border-bottom: 1px solid var(--border); }
.main { padding: var(--s4) var(--s3); } .main { padding: var(--s4) var(--s3); }
} }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4); } .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4); box-shadow: var(--shadow-sm); }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } .grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { font-size: 2rem; font-weight: 700; line-height: 1.1; } .row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .stat { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; } .row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; }
.btn { font: inherit; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-height: 44px; } .btn { font: inherit; font-weight: 500; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-height: 44px; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-2); } .btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); } .btn.primary:hover { filter: brightness(1.08); } .btn:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.danger { color: var(--err); border-color: var(--err); } .btn:disabled { opacity: .55; cursor: not-allowed; } .btn.small { min-height: 36px; padding: 6px 12px; } .btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: var(--err); } .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; } .btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.field { display: grid; gap: 6px; margin-bottom: var(--s3); } .field label { font-weight: 600; font-size: .9rem; } .field { display: grid; gap: 6px; margin-bottom: var(--s3); } .field label { font-weight: 600; font-size: .9rem; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-height: 44px; width: 100%; } input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 44px; width: 100%; }
input:focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.cols { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } .cols { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 12px var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; } th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); } table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 12px var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; } th { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
.tablewrap { overflow-x: auto; } tbody tr:hover { background: var(--surface-2); }
.badge { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; } .tablewrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.tablewrap table { border: none; } .tablewrap th:first-child, .tablewrap td:first-child { padding-left: var(--s3); }
.badge { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.info { background: var(--info-bg); color: var(--info); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.err { background: var(--err-bg); color: var(--err); } .badge.lock { background: var(--lock-bg); color: var(--lock); } .badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.info { background: var(--info-bg); color: var(--info); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.err { background: var(--err-bg); color: var(--err); } .badge.lock { background: var(--lock-bg); color: var(--lock); }
.alert { border-radius: 8px; padding: var(--s3); margin-bottom: var(--s3); border: 1px solid transparent; } .alert.err { background: var(--err-bg); color: var(--err); } .alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); } .alert { border-radius: var(--radius-sm); padding: var(--s3); margin-bottom: var(--s3); border: 1px solid transparent; } .alert.err { background: var(--err-bg); color: var(--err); } .alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }
.empty { text-align: center; padding: var(--s5) var(--s3); color: var(--muted); } .empty { text-align: center; padding: var(--s5) var(--s3); color: var(--muted); }
.center { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); } .auth { width: 100%; max-width: 420px; } .center { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); } .auth { width: 100%; max-width: 420px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; word-break: break-all; } .codes { columns: 2; background: var(--surface-2); padding: var(--s3); border-radius: 8px; } code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; word-break: break-all; } .codes { columns: 2; background: var(--surface-2); padding: var(--s3); border-radius: var(--radius-sm); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } } @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

View file

@ -1,9 +1,14 @@
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import { Inter } from 'next/font/google';
import './globals.css'; import './globals.css';
import { SessionProvider } from '@/lib/session'; import { SessionProvider } from '@/lib/session';
const inter = Inter({ subsets: ['latin'], variable: '--font-inter', display: 'swap' });
export const metadata: Metadata = { title: { default: 'Kundencenter', template: '%s · Kundencenter' }, robots: { index: false } }; export const metadata: Metadata = { title: { default: 'Kundencenter', template: '%s · Kundencenter' }, robots: { index: false } };
// Verhindert einen kurzen Blitz der falschen Darstellung: setzt die gespeicherte Wahl (falls vorhanden), bevor die Seite gemalt wird.
const themeInit = "try{var t=localStorage.getItem('kc-theme');if(t==='light'||t==='dark')document.documentElement.setAttribute('data-theme',t);}catch(e){}";
export default function RootLayout({ children }: { children: ReactNode }) { export default function RootLayout({ children }: { children: ReactNode }) {
return <html lang="de"><body><a className="skip" href="#main">Zum Inhalt springen</a><SessionProvider>{children}</SessionProvider></body></html>; return <html lang="de" className={inter.variable}><head><script dangerouslySetInnerHTML={{ __html: themeInit }} /></head>
<body><a className="skip" href="#main">Zum Inhalt springen</a><SessionProvider>{children}</SessionProvider></body></html>;
} }

View file

@ -5,6 +5,7 @@ import Link from 'next/link';
import { api, errMsg, setCsrf } from '@/lib/api'; import { api, errMsg, setCsrf } from '@/lib/api';
import { useSession } from '@/lib/session'; import { useSession } from '@/lib/session';
import { Alert, Field } from '@/components/ui'; import { Alert, Field } from '@/components/ui';
import { ThemeToggle } from '@/components/ThemeToggle';
export default function Login() { export default function Login() {
const r = useRouter(); const { me, reload } = useSession(); const r = useRouter(); const { me, reload } = useSession();
@ -28,7 +29,7 @@ export default function Login() {
} }
return ( return (
<main id="main" className="center"><div className="auth card"> <main id="main" className="center"><div className="auth card">
<h1>{step === 'pw' ? 'Anmelden' : 'Zweiter Faktor'}</h1> <div className="row between" style={{ marginBottom: 8 }}><h1 style={{ margin: 0 }}>{step === 'pw' ? 'Anmelden' : 'Zweiter Faktor'}</h1><ThemeToggle compact /></div>
{err && <Alert kind="err">{err}</Alert>} {err && <Alert kind="err">{err}</Alert>}
<form onSubmit={submit}> <form onSubmit={submit}>
{step === 'pw' ? (<> {step === 'pw' ? (<>

View file

@ -0,0 +1,30 @@
'use client';
import { useEffect, useState } from 'react';
type Theme = 'light' | 'dark' | 'system';
const KEY = 'kc-theme';
const LABEL: Record<Theme, string> = { system: 'System', light: 'Hell', dark: 'Dunkel' };
const ICON: Record<Theme, string> = { system: '🌓', light: '☀️', dark: '🌙' };
const NEXT: Record<Theme, Theme> = { system: 'light', light: 'dark', dark: 'system' };
function apply(t: Theme) {
if (t === 'system') document.documentElement.removeAttribute('data-theme');
else document.documentElement.setAttribute('data-theme', t);
}
/** Umschalter Tag/Nacht/System-Darstellung. Merkt sich die Wahl im Browser (nur dieses Gerät); ohne Wahl folgt die Ansicht automatisch dem Betriebssystem. */
export function ThemeToggle({ compact = false }: { compact?: boolean }) {
const [theme, setTheme] = useState<Theme>('system');
useEffect(() => {
try { const saved = localStorage.getItem(KEY); if (saved === 'light' || saved === 'dark') setTheme(saved); } catch { /* privates Fenster o. Ä. */ }
}, []);
function cycle() {
const next = NEXT[theme]; setTheme(next); apply(next);
try { if (next === 'system') localStorage.removeItem(KEY); else localStorage.setItem(KEY, next); } catch { /* ignorieren */ }
}
return (
<button type="button" className="btn small" onClick={cycle} title={`Darstellung: ${LABEL[theme]}. Klicken zum Wechseln.`} aria-label={`Darstellung: ${LABEL[theme]}. Klicken zum Wechseln.`}>
<span aria-hidden="true">{ICON[theme]}</span>{!compact && <> {LABEL[theme]}</>}
</button>
);
}