/* Tokeny semantyczne — dwie warstwy: prymitywy (paleta) i znaczenie (--surface, --text-...).
   Paleta inspirowana gtd.bladek.pl (granat/biel, sidebar+page-shell), zbudowana od zera
   jako tokeny + data-theme serwerowy — GTD samo tego nie ma (spec rozdz. 9.1, .ai/DECISIONS.md). */

:root {
    --p-navy-900: #020617;
    --p-navy-800: #0f172a;
    --p-slate-700: #334155;
    --p-slate-500: #64748b;
    --p-slate-300: #cbd5e1;
    --p-slate-200: #e2e8f0;
    --p-slate-100: #f1f5f9;
    --p-white: #ffffff;
    --p-blue-600: #2563eb;
    --p-blue-800: #1e3a8a;
    --p-green-700: #166534;
    --p-green-50: #ecfdf5;
    --p-red-700: #b91c1c;
    --p-red-50: #fef2f2;

    --font-mono-nums: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

:root[data-theme="light"] {
    --surface: var(--p-navy-800);
    --surface-raised: var(--p-white);
    --surface-sidebar: var(--p-navy-900);
    --text-primary: #111827;
    --text-muted: #6b7280;
    --text-on-dark: var(--p-slate-200);
    --border: var(--p-slate-200);
    --accent: var(--p-blue-800);
    --accent-contrast: var(--p-white);
    --positive: var(--p-green-700);
    --positive-bg: var(--p-green-50);
    --negative: var(--p-red-700);
    --negative-bg: var(--p-red-50);
}

:root[data-theme="dark"] {
    --surface: var(--p-navy-900);
    --surface-raised: #111827;
    --surface-sidebar: #000000;
    --text-primary: var(--p-slate-100);
    --text-muted: var(--p-slate-300);
    --text-on-dark: var(--p-slate-200);
    --border: var(--p-slate-700);
    --accent: var(--p-blue-600);
    --accent-contrast: var(--p-white);
    --positive: #4ade80;
    --positive-bg: #052e1a;
    --negative: #f87171;
    --negative-bg: #3f0d0d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--surface);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 56px;
    flex-shrink: 0;
    background: var(--surface-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
}

.sidebar-brand {
    color: var(--text-on-dark);
    font-weight: 700;
    margin-bottom: 12px;
}

.sidebar-link,
.sidebar-logout button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--text-on-dark);
    text-decoration: none;
    font-size: 1.1rem;
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
}

.sidebar-link:hover,
.sidebar-logout button:hover {
    background: var(--accent);
    color: var(--accent-contrast);
}

.sidebar-link span,
.sidebar-logout button span {
    display: none;
}

.sidebar-logout {
    margin-top: auto;
}

.page-shell {
    flex: 1;
    margin: 16px;
    padding: 24px;
    background: var(--surface-raised);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
    min-height: calc(100vh - 32px);
}

.page-shell--standalone {
    max-width: 420px;
    margin: 10vh auto;
}

.page-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
}

h1, h2, h3 { color: var(--text-primary); }

.muted { color: var(--text-muted); }

.amount {
    font-family: var(--font-mono-nums);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.amount--positive { color: var(--positive); }
.amount--negative { color: var(--negative); }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-primary);
    font-size: 1rem;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 1rem;
    cursor: pointer;
}

.btn:hover { opacity: 0.9; }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert--error {
    background: var(--negative-bg);
    color: var(--negative);
}

@media (max-width: 720px) {
    .page-shell { margin: 8px; padding: 16px; }
}
