/* Nutria v003 — global base: design tokens (UI/UX doc v2 §4/§14), typography, base elements.
   Rule: no hex colors outside this file — components use tokens only. */

:root {
    /* colors — light (reference) */
    --bg: #F7F7F5;
    --surface: #FFFFFF;

    --fg: #111111;
    --muted: #6B6B67;
    --faint: #969692;

    --border: #E6E6E2;
    --border-strong: #D8D8D3;

    --accent: #4E9A5B;
    --accent-hover: #43864F;
    --accent-soft: #EDF6EE;
    --accent-fg: #FFFFFF;

    --danger: #C85A54;
    --warning: #C58B3A;

    --input-bg: #EFEFED;
    --tabbar-bg: rgba(255, 255, 255, 0.96);
    --backdrop: rgba(0, 0, 0, 0.45);
    --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);

    /* spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --spacing: var(--space-4); /* alias for existing code */

    /* radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-sheet: 24px;
    --radius: var(--radius-md); /* alias for existing code */

    /* typography */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.25rem;
    --font-xl: 1.75rem;
    --font-2xl: 2.5rem;

    --tab-bar-height: 60px;
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* dark tokens — mounted twice: manual choice and system preference (doc v2 §14) */
:root[data-theme="dark"] {
    --bg: #101110;
    --surface: #181918;

    --fg: #F5F5F2;
    --muted: #A8A8A3;
    --faint: #7C7C77;

    --border: #262725;
    --border-strong: #33342F;

    --accent: #5FAE6C;
    --accent-hover: #6FBE7C;
    --accent-soft: #18271B;
    --accent-fg: #0E140F;

    --danger: #D9736D;
    --warning: #D4A257;

    --input-bg: #222321;
    --tabbar-bg: rgba(24, 25, 24, 0.96);
    --backdrop: rgba(0, 0, 0, 0.6);
    --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #101110;
        --surface: #181918;

        --fg: #F5F5F2;
        --muted: #A8A8A3;
        --faint: #7C7C77;

        --border: #262725;
        --border-strong: #33342F;

        --accent: #5FAE6C;
        --accent-hover: #6FBE7C;
        --accent-soft: #18271B;
        --accent-fg: #0E140F;

        --danger: #D9736D;
        --warning: #D4A257;

        --input-bg: #222321;
        --tabbar-bg: rgba(24, 25, 24, 0.96);
        --backdrop: rgba(0, 0, 0, 0.6);
        --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* scrollbars ausblenden, Scrollen bleibt möglich */
* {
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--fg);
}

h1 {
    font-size: var(--font-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing);
}

h2 {
    font-size: var(--font-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 calc(var(--spacing) / 2);
}

p {
    margin: 0 0 var(--spacing);
}

a {
    color: var(--fg);
}

button {
    font: inherit;
    color: var(--fg);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 14px;
    min-height: 44px;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

button.primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
    font-weight: 600;
}

button.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

button.danger {
    color: var(--danger);
}

/* icon-only buttons (chevrons, close, list actions) */
button.icon-button {
    border: none;
    background: none;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

input,
select {
    font: inherit;
    color: var(--fg);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 12px;
    width: 100%;
    min-height: 44px;
}

input[type="search"] {
    background: var(--input-bg);
    border: none;
    height: 48px;
    padding: 0 16px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.muted {
    color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
