:root {
    /* --- DESIGN SYSTEM: COLORS --- */
    
    /* Brand Colors */
    --primary: #f1c40f;
    --primary-hover: #d4ac0d;
    --primary-soft: rgba(241, 196, 15, 0.1);
    --primary-text: #1a1a1b;
    
    /* Base Colors (Slate Palette) */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Semantic Colors */
    --success: #22c55e;
    --success-soft: #f0fdf4;
    --warning: #eab308;
    --warning-soft: #fef9c3;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --info: #0ea5e9;
    --info-soft: #e0f2fe;

    /* Surface & Layout */
    --bg-app: #f1f3f5;
    --surface: #ffffff;
    --dark-surface: #111214;
    --border: var(--slate-200);
    --border-soft: rgba(226, 232, 240, 0.5);
    
    /* Text */
    --text-main: var(--slate-800);
    --text-muted: var(--slate-500);
    --text-light: var(--slate-400);
    --text-white: #ffffff;

    /* --- DESIGN SYSTEM: DIMENSIONS --- */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* --- UTILITY CLASSES --- */

/* Display & Flex */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.flex-column { flex-direction: column !important; }
.align-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-end { justify-content: flex-end !important; }

/* Global tooltip */
.app-tooltip {
    position: fixed;
    z-index: 15000;
    max-width: 320px;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid #1f2937;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    font-size: 0.74rem;
    line-height: 1.35;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.35);
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 120ms ease, transform 120ms ease;
    white-space: normal;
}
.app-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-tooltip[data-tone="info"] {
    border-color: #1d4ed8;
    background: rgba(30, 64, 175, 0.96);
}
.app-tooltip[data-tone="success"] {
    border-color: #15803d;
    background: rgba(21, 128, 61, 0.96);
}
.app-tooltip[data-tone="warn"] {
    border-color: #b45309;
    background: rgba(180, 83, 9, 0.96);
}
.app-tooltip[data-tone="danger"] {
    border-color: #b91c1c;
    background: rgba(185, 28, 28, 0.96);
}
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 !important; }

/* Spacing (Scale: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px) */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.5rem !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }

/* Text */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-muted { color: var(--text-muted) !important; }
.text-small { font-size: 0.75rem !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }

/* --- COMMON COMPONENTS --- */

/* Tabs */
.tabs-navigation {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: max-content;
}

.tab-item {
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tab-item a {
    display: block;
    padding: 10px 16px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--text-main);
    background: var(--slate-50);
    border-color: var(--border);
}

.tab-item.active {
    color: var(--primary-text);
    background: var(--primary-soft);
    border-color: rgba(241, 196, 15, 0.25);
    box-shadow: inset 0 0 0 1px rgba(241, 196, 15, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-text);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.2);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--slate-100);
    color: var(--slate-700);
    border-color: var(--slate-200);
}

.btn-secondary:hover {
    background-color: var(--slate-200);
    color: var(--slate-900);
}

.btn-danger {
    background-color: var(--danger-soft);
    color: var(--danger);
    border-color: var(--danger-soft);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    gap: 5px;
    border-radius: var(--radius-sm);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.7rem;
    gap: 4px;
    border-radius: var(--radius-sm);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #fde68a; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* Typography */
.h-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--slate-800);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* Opis pod tytułem strony (globalnie, tylko w page-header) */
.page-header .text-muted {
    font-family: "Inter", "Segoe UI", -apple-system, system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0.01em;
    color: var(--slate-600) !important;
}
