/* ============================================================
   AutoFlow — Design System
   Blueprint / Workshop base + neon accents (OCR, status)
   ============================================================ */

:root {
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    /* Spacing (8px grid) */
    --s-1: 4px;   --s-2: 8px;   --s-3: 16px;
    --s-4: 24px;  --s-5: 32px;  --s-6: 48px;
    --s-7: 64px;  --s-8: 96px;

    /* Radius — sharp technical + soft card */
    --r-sharp: 4px;
    --r-soft: 12px;
    --r-card: 20px;
    --r-pill: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(0, 20, 60, 0.06);
    --shadow-md: 0 4px 12px -2px rgba(0, 20, 60, 0.08);
    --shadow-lg: 0 20px 50px -10px rgba(0, 10, 40, 0.12);
    --shadow-glow: 0 0 0 1px var(--accent), 0 0 24px -4px var(--accent-glow);

    /* Motion */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 0.15s;
    --dur-base: 0.25s;
    --dur-slow: 0.45s;
}

/* --- LIGHT (default) - blueprint paper --- */
:root,
[data-theme="light"] {
    --bg: #EEF2F8;
    --bg-grid: rgba(50, 80, 140, 0.04);
    --surface: #FFFFFF;
    --surface-2: #F6F9FE;
    --surface-3: #ECF1F9;
    --border: #D5DEEC;
    --border-strong: #B8C5DB;
    --text: #0B1426;
    --text-dim: #4E5E7A;
    --text-hint: #8495B0;

    --accent: #FF6B1A;
    --accent-hover: #FF8438;
    --accent-glow: rgba(255, 107, 26, 0.35);

    --mod-zlecenia: #00A8D9;
    --mod-zlecenia-soft: rgba(0, 168, 217, 0.10);
    --mod-hurtownie: #0EA65C;
    --mod-hurtownie-soft: rgba(14, 166, 92, 0.10);
    --mod-rozliczenia: #D97706;
    --mod-rozliczenia-soft: rgba(217, 119, 6, 0.10);

    --ok: #0EA65C;
    --warn: #D97706;
    --danger: #DC2626;
}

/* --- DARK - pit lane / instrument cluster --- */
[data-theme="dark"] {
    --bg: #07101F;
    --bg-grid: rgba(90, 150, 220, 0.06);
    --surface: #0F1B30;
    --surface-2: #152341;
    --surface-3: #1D2E52;
    --border: rgba(120, 165, 220, 0.10);
    --border-strong: rgba(120, 165, 220, 0.22);
    --text: #E6EDF7;
    --text-dim: #8A9BB8;
    --text-hint: #5A6B88;

    --accent: #FF7A2E;
    --accent-hover: #FF9555;
    --accent-glow: rgba(255, 122, 46, 0.55);

    --mod-zlecenia: #22D3EE;
    --mod-zlecenia-soft: rgba(34, 211, 238, 0.12);
    --mod-hurtownie: #34D399;
    --mod-hurtownie-soft: rgba(52, 211, 153, 0.12);
    --mod-rozliczenia: #FBBF24;
    --mod-rozliczenia-soft: rgba(251, 191, 36, 0.12);

    --ok: #34D399;
    --warn: #FBBF24;
    --danger: #F87171;
}

/* --- RESET --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html { text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    /* Blueprint grid background */
    background-image:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--s-4) var(--s-3);
    transition: background-color var(--dur-base), color var(--dur-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* --- HEADER --- */
header {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-2);
    max-width: 1400px;
    width: 100%;
    margin: 0 auto var(--s-5);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background-image: linear-gradient(90deg, var(--border-strong) 0 8px, transparent 8px 16px);
    background-size: 16px 1px;
    opacity: 0.7;
}

.header-brand {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
    min-width: 0;
    flex-shrink: 1;
}

header h1 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

header h1::before {
    content: '';
    width: 6px;
    height: 28px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--accent-glow);
}

header .subtitle {
    color: var(--text-dim);
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 600px) {
    header {
        gap: var(--s-2);
        padding: var(--s-2) var(--s-3);
    }
    header h1 { font-size: 1.25rem; }
    header h1::before { width: 4px; height: 22px; }
    header .subtitle { display: none; }
}

/* --- LAYOUT --- */
.view-container {
    flex-grow: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- HEADINGS --- */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

/* --- UTIL CLASSES --- */
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }

.section-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--s-3);
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
.section-label::before {
    content: '';
    width: 18px;
    height: 1px;
    background: var(--border-strong);
}
