/**
 * ============================================
 * DEFINIUM SECURITY CENTER — Design System
 * ============================================
 * One stylesheet for the whole app.
 *
 * Sections:
 *  1. Tokens (CSS custom properties)
 *  2. Reset & base
 *  3. Typography
 *  4. Layout utilities (grid, flex, spacing, sizing)
 *  5. Color & border utilities
 *  6. Components: buttons, forms, cards, badges,
 *     alerts, tables, progress, breadcrumbs,
 *     list-group, avatar, modal, dropdown,
 *     dfn-modal (vanilla), page-header
 *  7. Auth layout
 *  8. Animations & helpers
 *
 * Brand palette
 *   #FFC700  pixel-sun (primary accent)
 *   #1A1A1A  ink (text)
 *   #6B7280  graphite (muted text)
 *   #E5E7EB  silver (border)
 *   #F5F5F5  fog (background)
 */

/* =====================================================
   1. TOKENS
   ===================================================== */
:root {
    /* Brand */
    --color-primary:        #FFC700;
    --color-primary-hover:  #EAB308;
    --color-primary-100:    rgba(255, 199, 0, 0.10);
    --color-primary-200:    rgba(255, 199, 0, 0.20);
    --color-primary-shadow: 0 6px 22px rgba(255, 199, 0, 0.28);

    /* Status — modern palette */
    --color-success:   #10B981;
    --color-warning:   #F59E0B;
    --color-danger:    #EF4444;
    --color-info:      #3B82F6;
    --color-success-100: rgba(16, 185, 129, 0.10);
    --color-warning-100: rgba(245, 158, 11, 0.10);
    --color-danger-100:  rgba(239, 68, 68, 0.10);
    --color-info-100:    rgba(59, 130, 246, 0.10);
    --color-secondary:   #6B7280;
    --color-secondary-100: rgba(100, 116, 139, 0.10);

    /* Severity (Guard module) */
    --color-severity-critical: #DC2626;
    --color-severity-high:     #EA580C;
    --color-severity-medium:   #F59E0B;
    --color-severity-low:      #6B7280;

    /* Light-mode surfaces — neutral grays (no slate/blue cast) */
    --color-bg:           #F5F5F5;
    --color-bg-secondary: #FFFFFF;
    --color-bg-hover:     #EEEEEE;
    --color-surface:      #FFFFFF;
    --color-surface-hover:#EEEEEE;

    /* Light-mode text */
    --color-text:           #1A1A1A;
    --color-text-secondary: #4B5563;
    --color-text-muted:     #6B7280;
    --color-text-on-primary:#000000;

    /* Borders */
    --color-border:       #E5E7EB;
    --color-border-hover: #D1D5DB;
    --color-border-soft:  rgba(0, 0, 0, 0.06);

    /* Bootstrap-compat helpers (so existing rgba() utilities work) */
    --bs-primary-rgb:   255, 199, 0;
    --bs-success-rgb:   16, 185, 129;
    --bs-warning-rgb:   245, 158, 11;
    --bs-danger-rgb:    239, 68, 68;
    --bs-info-rgb:      59, 130, 246;
    --bs-secondary-rgb: 107, 114, 128;
    --bs-light-rgb:     243, 244, 246;
    --bs-dark-rgb:      26, 26, 26;

    /* Shadows — neutral black tint */
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12), 0 6px 10px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.18), 0 12px 20px rgba(0, 0, 0, 0.10);

    /* Spacing scale (matches Bootstrap 5 0..5) */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 3rem;
    /* Legacy aliases used elsewhere in the app */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --font-size-xxs: 0.6875rem;  /* 11px */
    --font-size-xs:  0.75rem;    /* 12px */
    --font-size-sm:  0.875rem;   /* 14px */
    --font-size-base:1rem;       /* 16px */
    --font-size-lg:  1.125rem;   /* 18px */
    --font-size-xl:  1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */

    /* Transitions */
    --transition-fast:   120ms ease;
    --transition-normal: 220ms ease;

    /* Z-index */
    --z-dropdown: 80;
    --z-sticky:   90;
    --z-fixed:    100;
    --z-modal:    200;
    --z-toast:    300;

    /* Layout */
    --sidebar-width: 260px;
    --navbar-height: 64px;

    /* Compatibility aliases — views use these names */
    --bg-card:       var(--color-surface);
    --border-color:  var(--color-border);
    --text-main:     var(--color-text);
    --text-muted:    var(--color-text-muted);
}

/* Dark theme — neutral darks (no slate cast) */
[data-theme="dark"],
body.auth-page {
    --color-bg:           #1A1A1A;
    --color-bg-secondary: #2A2A2A;
    --color-bg-hover:     #333333;
    --color-surface:      #2A2A2A;
    --color-surface-hover:#333333;

    --color-text:           #FFFFFF;
    --color-text-secondary: #C6C5C5;
    /* a11y (WCAG 1.4.3): #9CA3AF dawało ~4.98:1 na najjaśniejszym ciemnym
       panelu (--color-bg-hover #333333) — formalnie zda, ale bez zapasu.
       #B6BECC podnosi do ~6.75:1 (a do ~9.3:1 na #1A1A1A), z komfortowym
       marginesem dla małego tekstu pomocniczego. */
    --color-text-muted:     #B6BECC;

    --color-border:       #3A3A3A;
    --color-border-hover: #4A4A4A;
    --color-border-soft:  rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.6), 0 12px 20px rgba(0, 0, 0, 0.4);

    /* Compatibility aliases — views use these names */
    --bg-card:       var(--color-surface);
    --border-color:  var(--color-border);
    --text-main:     var(--color-text);
    --text-muted:    var(--color-text-muted);
}

/* =====================================================
   2. RESET & BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.55;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: var(--color-primary-hover); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary); }
img, svg { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 1rem 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
code { padding: 0.1em 0.3em; background: var(--color-bg-secondary); border-radius: 4px; color: var(--color-text); }

::selection { background: var(--color-primary-200); color: var(--color-text); }

/* Scrollbar polish */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; border: 2px solid var(--color-bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--color-border-hover); }

/* =====================================================
   3. TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    letter-spacing: -0.01em;
}
h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); font-weight: 600; }
h6 { font-size: var(--font-size-sm); font-weight: 600; }

p { margin-bottom: 0; }

.font-monospace { font-family: var(--font-mono); }

/* Text colors */
.text-primary     { color: var(--color-primary) !important; }
.text-secondary   { color: var(--color-text-secondary) !important; }
.text-success     { color: var(--color-success) !important; }
.text-warning     { color: var(--color-warning) !important; }
.text-danger      { color: var(--color-danger) !important; }
.text-info        { color: var(--color-info) !important; }
.text-muted       { color: var(--color-text-muted) !important; }
.text-dark        { color: var(--color-text) !important; }
.text-light       { color: #FFFFFF !important; }
.text-body        { color: var(--color-text) !important; }
.text-on-surface  { color: var(--color-text) !important; }

/* Text sizes */
.text-xxs  { font-size: var(--font-size-xxs); }
.text-xs   { font-size: var(--font-size-xs); }
.text-sm   { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg   { font-size: var(--font-size-lg); }
.text-xl   { font-size: var(--font-size-xl); }
.text-2xl  { font-size: var(--font-size-2xl); }

/* Bootstrap fs-1..6 aliases */
.fs-1 { font-size: var(--font-size-4xl); }
.fs-2 { font-size: var(--font-size-3xl); }
.fs-3 { font-size: var(--font-size-2xl); }
.fs-4 { font-size: var(--font-size-xl); }
.fs-5 { font-size: var(--font-size-lg); }
.fs-6 { font-size: var(--font-size-base); }

/* Weights */
.fw-light  { font-weight: 300; }
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-500    { font-weight: 500; }
.fw-600    { font-weight: 600; }
.fw-semibold { font-weight: 600; }
.fw-bold   { font-weight: 700; }
.fw-700    { font-weight: 700; }
.fw-800    { font-weight: 800; }

/* Alignment */
.text-start    { text-align: left; }
.text-center   { text-align: center; }
.text-end      { text-align: right; }
.text-justify  { text-align: justify; }

/* Decoration */
.text-uppercase   { text-transform: uppercase; letter-spacing: 0.04em; }
.text-capitalize  { text-transform: capitalize; }
.text-lowercase   { text-transform: lowercase; }
.text-decoration-none { text-decoration: none; }
.text-decoration-underline { text-decoration: underline; }
.text-nowrap      { white-space: nowrap; }
.text-truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Line height */
.lh-1    { line-height: 1; }
.lh-sm   { line-height: 1.25; }
.lh-base { line-height: 1.5; }
.lh-lg   { line-height: 1.75; }

/* =====================================================
   4. LAYOUT UTILITIES
   ===================================================== */

/* Display */
.d-none         { display: none !important; }
.d-block        { display: block; }
.d-inline       { display: inline; }
.d-inline-block { display: inline-block; }
.d-inline-flex  { display: inline-flex; }
.d-flex         { display: flex; }
.d-grid         { display: grid; }
.d-table        { display: table; }

@media (min-width: 576px) { .d-sm-none{display:none !important;} .d-sm-block{display:block;} .d-sm-flex{display:flex;} .d-sm-inline-flex{display:inline-flex;} }
@media (min-width: 768px) { .d-md-none{display:none !important;} .d-md-block{display:block;} .d-md-flex{display:flex;} .d-md-inline-flex{display:inline-flex;} }
@media (min-width: 992px) { .d-lg-none{display:none !important;} .d-lg-block{display:block;} .d-lg-flex{display:flex;} .d-lg-inline-flex{display:inline-flex;} }
@media (min-width: 1200px){ .d-xl-none{display:none !important;} .d-xl-block{display:block;} .d-xl-flex{display:flex;} }

/* Flex helpers */
.flex-row        { flex-direction: row; }
.flex-row-reverse{ flex-direction: row-reverse; }
.flex-column     { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.flex-nowrap     { flex-wrap: nowrap; }
.flex-grow-0     { flex-grow: 0; }
.flex-grow-1     { flex-grow: 1; }
.flex-shrink-0   { flex-shrink: 0; }
.flex-fill       { flex: 1 1 auto; }

.justify-content-start    { justify-content: flex-start; }
.justify-content-end      { justify-content: flex-end; }
.justify-content-center   { justify-content: center; }
.justify-content-between  { justify-content: space-between; }
.justify-content-around   { justify-content: space-around; }
.justify-content-evenly   { justify-content: space-evenly; }

.align-items-start    { align-items: flex-start; }
.align-items-end      { align-items: flex-end; }
.align-items-center   { align-items: center; }
.align-items-baseline { align-items: baseline; }
.align-items-stretch  { align-items: stretch; }

.align-self-start    { align-self: flex-start; }
.align-self-end      { align-self: flex-end; }
.align-self-center   { align-self: center; }
.align-self-stretch  { align-self: stretch; }

.align-middle  { vertical-align: middle; }
.align-top     { vertical-align: top; }
.align-bottom  { vertical-align: bottom; }

/* Position */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed    { position: fixed; }
.position-sticky   { position: sticky; }
.position-static   { position: static; }
.top-0    { top: 0; } .end-0 { right: 0; } .bottom-0 { bottom: 0; } .start-0 { left: 0; }
.inset-0  { inset: 0; }

/* Gap (rem-based) */
.gap-0 { gap: 0; }       .gap-1 { gap: 0.25rem; }  .gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }    .gap-4 { gap: 1.5rem; }   .gap-5 { gap: 3rem; }
.gap-sm { gap: 0.5rem; } .gap-md { gap: 1rem; }    .gap-lg { gap: 1.5rem; }
.row-gap-2 { row-gap: 0.5rem; } .row-gap-3 { row-gap: 1rem; }
.column-gap-2 { column-gap: 0.5rem; } .column-gap-3 { column-gap: 1rem; }

/* -------------------------------------------------------------------------
   Aliasy utility w konwencji Tailwind (A-B2)
   Część widoków używa nazw Tailwind-owych (flex, items-center, justify-between,
   mb-sm…) zamiast bazowej konwencji Bootstrap (d-flex, align-items-center…).
   Aliasy mapują je 1:1 na istniejące tokeny — jedna zmiana naprawia wszystkie
   widoki i przyszłe użycia. Nie nadpisują istniejących reguł (.flex-* itd.).
   ------------------------------------------------------------------------- */
.flex            { display: flex; }
.inline-flex     { display: inline-flex; }
.flex-col        { flex-direction: column; }
.flex-1          { flex: 1 1 0%; }

.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.items-center    { align-items: center; }
.items-baseline  { align-items: baseline; }
.items-stretch   { align-items: stretch; }

.justify-start   { justify-content: flex-start; }
.justify-end     { justify-content: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }

/* Marginesy w skali tokenów (sm/md/lg) — uzupełnienie numerycznej skali m-0..5 */
.m-sm  { margin: 0.5rem; }        .m-md  { margin: 1rem; }        .m-lg  { margin: 1.5rem; }
.mt-sm { margin-top: 0.5rem; }    .mt-md { margin-top: 1rem; }    .mt-lg { margin-top: 1.5rem; }
.mb-sm { margin-bottom: 0.5rem; } .mb-md { margin-bottom: 1rem; } .mb-lg { margin-bottom: 1.5rem; }
.ms-sm { margin-left: 0.5rem; }   .ms-md { margin-left: 1rem; }   .ms-lg { margin-left: 1.5rem; }
.me-sm { margin-right: 0.5rem; }  .me-md { margin-right: 1rem; }  .me-lg { margin-right: 1.5rem; }

/* Margin / padding shortcut macros — generated for 0..5 */
.m-0 {margin:0;} .m-1 {margin:.25rem;} .m-2 {margin:.5rem;} .m-3 {margin:1rem;} .m-4 {margin:1.5rem;} .m-5 {margin:3rem;}
.mt-0 {margin-top:0;} .mt-1 {margin-top:.25rem;} .mt-2 {margin-top:.5rem;} .mt-3 {margin-top:1rem;} .mt-4 {margin-top:1.5rem;} .mt-5 {margin-top:3rem;}
.mb-0 {margin-bottom:0;} .mb-1 {margin-bottom:.25rem;} .mb-2 {margin-bottom:.5rem;} .mb-3 {margin-bottom:1rem;} .mb-4 {margin-bottom:1.5rem;} .mb-5 {margin-bottom:3rem;}
.ms-0 {margin-left:0;} .ms-1 {margin-left:.25rem;} .ms-2 {margin-left:.5rem;} .ms-3 {margin-left:1rem;} .ms-4 {margin-left:1.5rem;} .ms-auto {margin-left:auto;}
.me-0 {margin-right:0;} .me-1 {margin-right:.25rem;} .me-2 {margin-right:.5rem;} .me-3 {margin-right:1rem;} .me-4 {margin-right:1.5rem;} .me-auto {margin-right:auto;}
.mx-0 {margin-left:0;margin-right:0;} .mx-1 {margin-left:.25rem;margin-right:.25rem;} .mx-2 {margin-left:.5rem;margin-right:.5rem;} .mx-3 {margin-left:1rem;margin-right:1rem;} .mx-auto {margin-left:auto;margin-right:auto;}
.my-0 {margin-top:0;margin-bottom:0;} .my-1 {margin-top:.25rem;margin-bottom:.25rem;} .my-2 {margin-top:.5rem;margin-bottom:.5rem;} .my-3 {margin-top:1rem;margin-bottom:1rem;} .my-4 {margin-top:1.5rem;margin-bottom:1.5rem;} .my-5 {margin-top:3rem;margin-bottom:3rem;}

.p-0 {padding:0;} .p-1 {padding:.25rem;} .p-2 {padding:.5rem;} .p-3 {padding:1rem;} .p-4 {padding:1.5rem;} .p-5 {padding:3rem;}
.pt-0 {padding-top:0;} .pt-1 {padding-top:.25rem;} .pt-2 {padding-top:.5rem;} .pt-3 {padding-top:1rem;} .pt-4 {padding-top:1.5rem;} .pt-5 {padding-top:3rem;}
.pb-0 {padding-bottom:0;} .pb-1 {padding-bottom:.25rem;} .pb-2 {padding-bottom:.5rem;} .pb-3 {padding-bottom:1rem;} .pb-4 {padding-bottom:1.5rem;} .pb-5 {padding-bottom:3rem;}
.ps-0 {padding-left:0;} .ps-1 {padding-left:.25rem;} .ps-2 {padding-left:.5rem;} .ps-3 {padding-left:1rem;} .ps-4 {padding-left:1.5rem;}
.pe-0 {padding-right:0;} .pe-1 {padding-right:.25rem;} .pe-2 {padding-right:.5rem;} .pe-3 {padding-right:1rem;}
.px-0 {padding-left:0;padding-right:0;} .px-1 {padding-left:.25rem;padding-right:.25rem;} .px-2 {padding-left:.5rem;padding-right:.5rem;} .px-3 {padding-left:1rem;padding-right:1rem;} .px-4 {padding-left:1.5rem;padding-right:1.5rem;} .px-5 {padding-left:3rem;padding-right:3rem;}
.py-0 {padding-top:0;padding-bottom:0;} .py-1 {padding-top:.25rem;padding-bottom:.25rem;} .py-2 {padding-top:.5rem;padding-bottom:.5rem;} .py-3 {padding-top:1rem;padding-bottom:1rem;} .py-4 {padding-top:1.5rem;padding-bottom:1.5rem;} .py-5 {padding-top:3rem;padding-bottom:3rem;}

/* Sizing */
.w-25 { width: 25%; } .w-50 { width: 50%; } .w-75 { width: 75%; } .w-100 { width: 100%; } .w-auto { width: auto; }
.h-25 { height: 25%; } .h-50 { height: 50%; } .h-75 { height: 75%; } .h-100 { height: 100%; } .h-auto { height: auto; }
.mw-100 { max-width: 100%; } .mh-100 { max-height: 100%; }
.min-vh-100 { min-height: 100vh; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Container & grid (Bootstrap 5 compatible — gx default 1.5rem) */
.container, .container-fluid {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 576px)  { .container { max-width: 540px; } }
@media (min-width: 768px)  { .container { max-width: 720px; } }
@media (min-width: 992px)  { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }
@media (min-width: 1400px) { .container { max-width: 1320px; } }

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(var(--bs-gutter-y) * -1);
    margin-right: calc(var(--bs-gutter-x) * -0.5);
    margin-left:  calc(var(--bs-gutter-x) * -0.5);
}
.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left:  calc(var(--bs-gutter-x) * 0.5);
    margin-top: var(--bs-gutter-y);
}

.row-cols-1 > * { flex: 0 0 auto; width: 100%; }
.row-cols-2 > * { flex: 0 0 auto; width: 50%; }
.row-cols-3 > * { flex: 0 0 auto; width: 33.333333%; }
.row-cols-4 > * { flex: 0 0 auto; width: 25%; }

/* Gutters */
.g-0,.gx-0 { --bs-gutter-x: 0; } .g-0,.gy-0 { --bs-gutter-y: 0; }
.g-1,.gx-1 { --bs-gutter-x: 0.25rem; } .g-1,.gy-1 { --bs-gutter-y: 0.25rem; }
.g-2,.gx-2 { --bs-gutter-x: 0.5rem; }  .g-2,.gy-2 { --bs-gutter-y: 0.5rem; }
.g-3,.gx-3 { --bs-gutter-x: 1rem; }    .g-3,.gy-3 { --bs-gutter-y: 1rem; }
.g-4,.gx-4 { --bs-gutter-x: 1.5rem; }  .g-4,.gy-4 { --bs-gutter-y: 1.5rem; }
.g-5,.gx-5 { --bs-gutter-x: 3rem; }    .g-5,.gy-5 { --bs-gutter-y: 3rem; }

/* Cols 1..12, default (auto) and breakpoints */
.col       { flex: 1 0 0%; }
.col-auto  { flex: 0 0 auto; width: auto; }

.col-1  { flex: 0 0 auto; width: 8.333333%; }
.col-2  { flex: 0 0 auto; width: 16.666667%; }
.col-3  { flex: 0 0 auto; width: 25%; }
.col-4  { flex: 0 0 auto; width: 33.333333%; }
.col-5  { flex: 0 0 auto; width: 41.666667%; }
.col-6  { flex: 0 0 auto; width: 50%; }
.col-7  { flex: 0 0 auto; width: 58.333333%; }
.col-8  { flex: 0 0 auto; width: 66.666667%; }
.col-9  { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.333333%; }
.col-11 { flex: 0 0 auto; width: 91.666667%; }
.col-12 { flex: 0 0 auto; width: 100%; }

@media (min-width: 576px) {
    .col-sm { flex: 1 0 0%; }
    .col-sm-1{flex:0 0 auto;width:8.333333%;} .col-sm-2{flex:0 0 auto;width:16.666667%;} .col-sm-3{flex:0 0 auto;width:25%;}
    .col-sm-4{flex:0 0 auto;width:33.333333%;} .col-sm-5{flex:0 0 auto;width:41.666667%;} .col-sm-6{flex:0 0 auto;width:50%;}
    .col-sm-7{flex:0 0 auto;width:58.333333%;} .col-sm-8{flex:0 0 auto;width:66.666667%;} .col-sm-9{flex:0 0 auto;width:75%;}
    .col-sm-10{flex:0 0 auto;width:83.333333%;} .col-sm-11{flex:0 0 auto;width:91.666667%;} .col-sm-12{flex:0 0 auto;width:100%;}
}
@media (min-width: 768px) {
    .col-md { flex: 1 0 0%; }
    .col-md-1{flex:0 0 auto;width:8.333333%;} .col-md-2{flex:0 0 auto;width:16.666667%;} .col-md-3{flex:0 0 auto;width:25%;}
    .col-md-4{flex:0 0 auto;width:33.333333%;} .col-md-5{flex:0 0 auto;width:41.666667%;} .col-md-6{flex:0 0 auto;width:50%;}
    .col-md-7{flex:0 0 auto;width:58.333333%;} .col-md-8{flex:0 0 auto;width:66.666667%;} .col-md-9{flex:0 0 auto;width:75%;}
    .col-md-10{flex:0 0 auto;width:83.333333%;} .col-md-11{flex:0 0 auto;width:91.666667%;} .col-md-12{flex:0 0 auto;width:100%;}
}
@media (min-width: 992px) {
    .col-lg { flex: 1 0 0%; }
    .col-lg-1{flex:0 0 auto;width:8.333333%;} .col-lg-2{flex:0 0 auto;width:16.666667%;} .col-lg-3{flex:0 0 auto;width:25%;}
    .col-lg-4{flex:0 0 auto;width:33.333333%;} .col-lg-5{flex:0 0 auto;width:41.666667%;} .col-lg-6{flex:0 0 auto;width:50%;}
    .col-lg-7{flex:0 0 auto;width:58.333333%;} .col-lg-8{flex:0 0 auto;width:66.666667%;} .col-lg-9{flex:0 0 auto;width:75%;}
    .col-lg-10{flex:0 0 auto;width:83.333333%;} .col-lg-11{flex:0 0 auto;width:91.666667%;} .col-lg-12{flex:0 0 auto;width:100%;}
}
@media (min-width: 1200px) {
    .col-xl { flex: 1 0 0%; }
    .col-xl-1{flex:0 0 auto;width:8.333333%;} .col-xl-2{flex:0 0 auto;width:16.666667%;} .col-xl-3{flex:0 0 auto;width:25%;}
    .col-xl-4{flex:0 0 auto;width:33.333333%;} .col-xl-5{flex:0 0 auto;width:41.666667%;} .col-xl-6{flex:0 0 auto;width:50%;}
    .col-xl-7{flex:0 0 auto;width:58.333333%;} .col-xl-8{flex:0 0 auto;width:66.666667%;} .col-xl-9{flex:0 0 auto;width:75%;}
    .col-xl-10{flex:0 0 auto;width:83.333333%;} .col-xl-11{flex:0 0 auto;width:91.666667%;} .col-xl-12{flex:0 0 auto;width:100%;}
}

/* =====================================================
   5. COLOR & BORDER UTILITIES
   ===================================================== */

/* Background colors */
.bg-primary    { background-color: var(--color-primary) !important; color: var(--color-text-on-primary) !important; }
.bg-success    { background-color: var(--color-success) !important; color: #1A1A1A !important; }
.bg-warning    { background-color: var(--color-warning) !important; color: #1A1A1A !important; }
.bg-danger     { background-color: var(--color-danger) !important;  color: #FFFFFF !important; }
.bg-info       { background-color: var(--color-info) !important;    color: #FFFFFF !important; }
.bg-secondary  { background-color: var(--color-secondary) !important; color: #FFFFFF !important; }
.bg-dark       { background-color: var(--color-text) !important;    color: #FFFFFF !important; }
.bg-light      { background-color: var(--color-bg-hover) !important; color: var(--color-text) !important; }
.bg-white      { background-color: #FFFFFF !important; }
.bg-transparent{ background-color: transparent !important; }

/* Subtle / soft variants */
.bg-primary-subtle   { background-color: var(--color-primary-100) !important; color: var(--color-primary-hover); }
.bg-success-subtle   { background-color: var(--color-success-100) !important; color: var(--color-success); }
.bg-warning-subtle   { background-color: var(--color-warning-100) !important; color: var(--color-warning); }
.bg-danger-subtle    { background-color: var(--color-danger-100) !important;  color: var(--color-danger); }
.bg-info-subtle      { background-color: var(--color-info-100) !important;    color: var(--color-info); }
.bg-secondary-subtle { background-color: var(--color-secondary-100) !important; color: var(--color-secondary); }
.bg-dark-subtle      { background-color: rgba(0, 0, 0, 0.10) !important; color: var(--color-text-secondary); }
.bg-subtle-primary { background-color: var(--color-primary-100) !important; }
[data-theme="dark"] .bg-dark-subtle { background-color: rgba(255, 255, 255, 0.08) !important; }

/* Border colors */
.border           { border: 1px solid var(--color-border); }
.border-0         { border: 0 !important; }
.border-top       { border-top: 1px solid var(--color-border); }
.border-bottom    { border-bottom: 1px solid var(--color-border); }
.border-start     { border-left: 1px solid var(--color-border); }
.border-end       { border-right: 1px solid var(--color-border); }
.border-primary   { border-color: var(--color-primary) !important; }
.border-success   { border-color: var(--color-success) !important; }
.border-warning   { border-color: var(--color-warning) !important; }
.border-danger    { border-color: var(--color-danger) !important; }
.border-info      { border-color: var(--color-info) !important; }
.border-secondary { border-color: var(--color-secondary) !important; }
.border-light     { border-color: var(--color-border) !important; }

.border-primary-subtle   { border-color: var(--color-primary-200) !important; }
.border-success-subtle   { border-color: rgba(16,185,129,0.25) !important; }
.border-warning-subtle   { border-color: rgba(245,158,11,0.25) !important; }
.border-danger-subtle    { border-color: rgba(239,68,68,0.25) !important; }
.border-info-subtle      { border-color: rgba(59,130,246,0.25) !important; }

/* Border width variants */
.border-1 { border-width: 1px !important; } .border-2 { border-width: 2px !important; }
.border-3 { border-width: 3px !important; } .border-4 { border-width: 4px !important; }
.border-start-4 { border-left: 4px solid var(--color-border); }
.border-start-4.border-danger  { border-left-color: var(--color-danger); }
.border-start-4.border-warning { border-left-color: var(--color-warning); }
.border-start-4.border-primary { border-left-color: var(--color-primary); }
.border-start-4.border-success { border-left-color: var(--color-success); }
.border-start-4.border-info    { border-left-color: var(--color-info); }

/* Radius */
.rounded         { border-radius: var(--radius-md) !important; }
.rounded-0       { border-radius: 0 !important; }
.rounded-1       { border-radius: 4px !important; }
.rounded-2       { border-radius: var(--radius-sm) !important; }
.rounded-3       { border-radius: var(--radius-md) !important; }
.rounded-lg      { border-radius: var(--radius-lg) !important; }
.rounded-pill    { border-radius: var(--radius-full) !important; }
.rounded-circle  { border-radius: 50% !important; }

/* Shadows */
.shadow      { box-shadow: var(--shadow-md) !important; }
.shadow-sm   { box-shadow: var(--shadow-sm) !important; }
.shadow-lg   { box-shadow: var(--shadow-lg) !important; }
.shadow-none { box-shadow: none !important; }

/* Opacity */
.opacity-25 { opacity: 0.25; } .opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; } .opacity-100 { opacity: 1; }

/* Pusty stan (empty-state) — powtarzalny wzorzec (A-B6, ~13 widoków):
   wyszarzona, duża ikona placeholdera + komunikat. Zastępuje inline
   style="font-size:Nrem;opacity:0.3" na ikonach pustych list. */
.empty-state-icon    { font-size: 3rem; opacity: 0.3; display: inline-block; line-height: 1; }
.empty-state-icon-sm { font-size: 2rem; opacity: 0.3; display: inline-block; line-height: 1; }

/* =====================================================
   6. COMPONENTS
   ===================================================== */

/* ----- Buttons ----- */
.btn {
    --btn-bg: transparent;
    --btn-color: var(--color-text);
    --btn-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.4;
    background: var(--btn-bg);
    color: var(--btn-color);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                background-color var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast);
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled){ transform: translateY(0); }
.btn:focus-visible        { outline: 3px solid var(--color-primary-200); outline-offset: 1px; }
.btn:disabled             { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary        { --btn-bg: var(--color-primary); --btn-color: var(--color-text-on-primary); --btn-border: var(--color-primary); box-shadow: var(--color-primary-shadow); }
.btn-primary:hover:not(:disabled){ --btn-bg: var(--color-primary-hover); --btn-border: var(--color-primary-hover); }
.btn-secondary      { --btn-bg: var(--color-secondary); --btn-color: #FFFFFF; --btn-border: var(--color-secondary); }
.btn-secondary:hover:not(:disabled){ --btn-bg: #4B5563; --btn-border: #4B5563; }
.btn-success        { --btn-bg: var(--color-success); --btn-color: #1A1A1A; --btn-border: var(--color-success); }
.btn-success:hover:not(:disabled)  { --btn-bg: #0EA372; --btn-border: #0EA372; }
.btn-warning        { --btn-bg: var(--color-warning); --btn-color: #1A1A1A; --btn-border: var(--color-warning); }
.btn-warning:hover:not(:disabled)  { --btn-bg: #D97706; --btn-border: #D97706; }
.btn-danger         { --btn-bg: var(--color-danger); --btn-color: #FFFFFF; --btn-border: var(--color-danger); }
.btn-danger:hover:not(:disabled)   { --btn-bg: #DC2626; --btn-border: #DC2626; }
.btn-info           { --btn-bg: var(--color-info); --btn-color: #FFFFFF; --btn-border: var(--color-info); }

.btn-outline-primary   { --btn-color: var(--color-primary-hover); --btn-border: var(--color-primary); }
.btn-outline-primary:hover:not(:disabled){ --btn-bg: var(--color-primary-100); }
.btn-outline-secondary { --btn-color: var(--color-text-secondary); --btn-border: var(--color-border); }
.btn-outline-secondary:hover:not(:disabled){ --btn-bg: var(--color-bg-hover); --btn-color: var(--color-text); }
.btn-outline-success   { --btn-color: var(--color-success); --btn-border: var(--color-success); }
.btn-outline-success:hover:not(:disabled){ --btn-bg: var(--color-success-100); }
.btn-outline-warning   { --btn-color: var(--color-warning); --btn-border: var(--color-warning); }
.btn-outline-warning:hover:not(:disabled){ --btn-bg: var(--color-warning-100); }
.btn-outline-danger    { --btn-color: var(--color-danger); --btn-border: var(--color-danger); }
.btn-outline-danger:hover:not(:disabled){ --btn-bg: var(--color-danger-100); }
.btn-outline-info      { --btn-color: var(--color-info); --btn-border: var(--color-info); }

.btn-ghost  { --btn-color: var(--color-text-secondary); }
.btn-ghost:hover:not(:disabled){ --btn-bg: var(--color-bg-hover); --btn-color: var(--color-text); }
.btn-text   { --btn-color: var(--color-text-secondary); padding: 0.25rem 0.5rem; }
.btn-text:hover:not(:disabled){ --btn-color: var(--color-text); background: transparent; }
.btn-link   { --btn-color: var(--color-primary-hover); padding: 0.25rem 0.5rem; }

/* Subtle button variants */
.btn-subtle      { --btn-bg: var(--color-bg-hover); --btn-color: var(--color-text); }
.btn-subtle:hover:not(:disabled){ --btn-bg: var(--color-border); }

/* Sizes */
.btn-sm     { padding: 0.35rem 0.7rem; font-size: var(--font-size-xs); }
/* .btn-md — jawny alias domyślnej (bazowej) skali .btn. Pozwala oznaczyć
   przyciski logicznej rangi „średniej" tą samą klasą wielkości, gdy w widoku
   współwystępują .btn-sm/.btn-lg. Wartości == baza .btn (padding/font-size),
   więc nie zmienia renderu istniejących przycisków bez klasy rozmiaru. */
.btn-md     { padding: 0.55rem 1rem; font-size: var(--font-size-sm); }
.btn-lg     { padding: 0.8rem 1.4rem; font-size: var(--font-size-base); }
.btn-block  { width: 100%; }
.btn-icon   { padding: 0.5rem; aspect-ratio: 1/1; }

.btn-group  { display: inline-flex; gap: -1px; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.btn-group .btn:last-child  { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.btn-group-sm .btn { padding: 0.3rem 0.6rem; font-size: var(--font-size-xs); }

/* ----- Forms ----- */
.form-group { margin-bottom: 1.25rem; }
.form-label,
label.form-label {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

/* Generic input styling (applies to all text-like inputs) */
.form-input,
.form-control,
.form-select,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"],
input[type="search"], input[type="date"], input[type="time"],
input[type="datetime-local"],
textarea, select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-family: inherit;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    line-height: 1.5;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    -webkit-appearance: none; appearance: none;
}
.form-control-sm,
.form-select-sm { padding: 0.35rem 0.7rem; font-size: var(--font-size-xs); }
.form-control-lg,
.form-select-lg { padding: 0.7rem 1rem; font-size: var(--font-size-base); }

.form-input:focus, .form-control:focus, .form-select:focus,
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="tel"]:focus, input[type="url"]:focus,
input[type="search"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input[type="datetime-local"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-200);
}
.form-control::placeholder,
.form-input::placeholder,
input::placeholder, textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

/* Select with chevron */
select.form-select, select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 0.95rem;
    padding-right: 2.4rem;
    cursor: pointer;
}

textarea { resize: vertical; min-height: 96px; }

.form-text { color: var(--color-text-muted); font-size: var(--font-size-xs); margin-top: 0.25rem; }
.form-hint { color: var(--color-text-muted); font-size: var(--font-size-xs); margin-top: 0.25rem; }
.form-error { color: var(--color-danger); font-size: var(--font-size-xs); margin-top: 0.25rem; }

.form-input.is-invalid, .form-control.is-invalid {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px var(--color-danger-100);
}

/* Checkboxes & radios — keep existing custom look */
input[type="checkbox"], .form-check-input[type="checkbox"] {
    width: 1.125rem; height: 1.125rem;
    -webkit-appearance: none; appearance: none;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
input[type="checkbox"]:checked, .form-check-input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
input[type="checkbox"]:checked::after, .form-check-input[type="checkbox"]:checked::after {
    content: ''; display: block; width: 5px; height: 9px;
    border: solid #000; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-bottom: 2px;
}
input[type="checkbox"]:focus, input[type="radio"]:focus {
    outline: none; box-shadow: 0 0 0 3px var(--color-primary-200);
}

input[type="radio"], .form-check-input[type="radio"] {
    width: 1.125rem; height: 1.125rem;
    -webkit-appearance: none; appearance: none;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
input[type="radio"]:checked, .form-check-input[type="radio"]:checked {
    border-color: var(--color-primary);
}
input[type="radio"]:checked::after {
    content: ''; width: 8px; height: 8px;
    border-radius: 50%; background: var(--color-primary);
}

.form-check {
    display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
    padding: 0;
}
.form-check-label { font-size: var(--font-size-sm); color: var(--color-text); cursor: pointer; }

.form-switch {
    position: relative; display: inline-block;
    width: 44px; height: 24px; flex-shrink: 0;
}
.form-switch input { opacity: 0; width: 0; height: 0; }
.form-switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--color-border); border-radius: 999px;
    transition: all var(--transition-fast);
}
.form-switch-slider::before {
    content: ''; position: absolute;
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%;
    transition: all var(--transition-fast);
}
.form-switch input:checked + .form-switch-slider { background: var(--color-primary); }
.form-switch input:checked + .form-switch-slider::before { transform: translateX(20px); }

/* Input group */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.input-group > .form-control,
.input-group > .form-select,
.input-group > .btn,
.input-group > input { position: relative; flex: 1 1 auto; min-width: 0; }
.input-group > :not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.input-group > :not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; margin-left: -1px; }
.input-group-text {
    display: flex; align-items: center;
    padding: 0 1rem;
    background: var(--color-bg-hover);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

/* ----- Cards ----- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.card-header h3,
.card-header h4,
.card-header h5 { margin: 0; font-size: var(--font-size-base); font-weight: 700; }
.card-body   { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); background: var(--color-bg); }
.card-title  { font-size: var(--font-size-lg); font-weight: 700; margin: 0 0 0.5rem; }
.card-subtitle { color: var(--color-text-secondary); font-size: var(--font-size-sm); margin-bottom: 0.75rem; }

.card-stat {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    cursor: pointer;
}
.card-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--color-primary-200); }

/* ----- Badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xxs);
    font-weight: 600;
    line-height: 1.4;
    background: var(--color-bg-hover);
    color: var(--color-text);
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge.bg-primary   { background: var(--color-primary)  !important; color: var(--color-text-on-primary) !important; }
.badge.bg-success   { background: var(--color-success)  !important; color: #1A1A1A !important; }
.badge.bg-warning   { background: var(--color-warning)  !important; color: #1A1A1A !important; }
.badge.bg-danger    { background: var(--color-danger)   !important; color: #FFFFFF !important; }
.badge.bg-info      { background: var(--color-info)     !important; color: #FFFFFF !important; }
.badge.bg-secondary { background: var(--color-secondary)!important; color: #FFFFFF !important; }
.badge.bg-light     { background: var(--color-bg-hover) !important; color: var(--color-text); }

/* Subtle badges */
.badge-subtle-primary,   .badge.bg-primary-subtle   { background: var(--color-primary-100); color: var(--color-primary-hover); }
.badge-subtle-success,   .badge.bg-success-subtle   { background: var(--color-success-100); color: var(--color-success); }
.badge-subtle-warning,   .badge.bg-warning-subtle   { background: var(--color-warning-100); color: var(--color-warning); }
.badge-subtle-danger,    .badge.bg-danger-subtle    { background: var(--color-danger-100);  color: var(--color-danger); }
.badge-subtle-info,      .badge.bg-info-subtle      { background: var(--color-info-100);    color: var(--color-info); }
.badge-subtle-secondary, .badge.bg-secondary-subtle { background: var(--color-secondary-100); color: var(--color-secondary); }

/* Outline badges */
.badge-outline-primary   { background: transparent; border-color: var(--color-primary);   color: var(--color-primary-hover); }
.badge-outline-success   { background: transparent; border-color: var(--color-success);   color: var(--color-success); }
.badge-outline-warning   { background: transparent; border-color: var(--color-warning);   color: var(--color-warning); }
.badge-outline-danger    { background: transparent; border-color: var(--color-danger);    color: var(--color-danger); }
.badge-outline-info      { background: transparent; border-color: var(--color-info);      color: var(--color-info); }
.badge-outline-secondary { background: transparent; border-color: var(--color-border);    color: var(--color-text-secondary); }

/* ----- Alerts ----- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}
.alert > i { font-size: 1.1rem; line-height: 1; padding-top: 1px; flex-shrink: 0; }
/* Kontener treści alertu (A-B5): tytuł + akapit płyną pionowo jako jeden blok,
   obok ikony, zamiast rozjeżdżać się na dwie kolumny flex. */
.alert-body { flex: 1 1 auto; min-width: 0; }
/* G2 — link wewnątrz alertu dziedziczy kolor alertu (np. amber w .alert-warning)
   z podkreśleniem, zamiast domyślnego koloru linku, który mógłby nie kontrastować
   z tłem alertu. Czysty CSS (CSP-safe). */
.alert .alert-link { color: inherit; text-decoration: underline; }
.alert .alert-link:hover { text-decoration: none; }
.alert-success  { background: var(--color-success-100); border-color: rgba(16,185,129,0.25); color: #047857; }
.alert-warning  { background: var(--color-warning-100); border-color: rgba(245,158,11,0.25); color: #92400E; }
.alert-danger   { background: var(--color-danger-100);  border-color: rgba(239,68,68,0.25);  color: #B91C1C; }
.alert-info     { background: var(--color-info-100);    border-color: rgba(59,130,246,0.25); color: #1D4ED8; }

[data-theme="dark"] .alert-success,
body.auth-page .alert-success { color: var(--color-success); }
[data-theme="dark"] .alert-warning,
body.auth-page .alert-warning { color: var(--color-warning); }
[data-theme="dark"] .alert-danger,
body.auth-page .alert-danger  { color: var(--color-danger); }
[data-theme="dark"] .alert-info,
body.auth-page .alert-info    { color: var(--color-info); }

/* ----- Tables ----- */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    color: var(--color-text);
}
.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.table th {
    font-weight: 700;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom-width: 1px;
}
.table tbody tr { transition: background-color var(--transition-fast); }
.table-hover tbody tr:hover { background: var(--color-bg-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table.align-middle td,
.table.align-middle th { vertical-align: middle; }
.table-sm th, .table-sm td { padding: 0.45rem 0.7rem; }

/* ----- Progress ----- */
.progress {
    height: 8px;
    background: var(--color-bg-hover);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.4s ease;
}

/* ----- Breadcrumb ----- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 0.25rem;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 0.5rem;
    color: var(--color-text-muted);
}
.breadcrumb-item a { color: var(--color-text-secondary); }
.breadcrumb-item.active { color: var(--color-text); }

/* ----- List group ----- */
.list-group {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.list-group-flush { border-radius: 0; }
.list-group-item {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
}
.list-group-item:first-child { border-top: 0; }
.list-group-item-action:hover { background: var(--color-bg-hover); }
.list-group-item.active { background: var(--color-primary-100); color: var(--color-primary-hover); }

/* ----- Avatar ----- */
.avatar {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-xs); border-radius: var(--radius-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--font-size-lg); }

/* ----- Modal (Bootstrap-style; vanilla JS toggles .show via dropdown helper) ----- */
.modal {
    position: fixed; inset: 0;
    z-index: var(--z-modal);
    overflow: hidden;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 1rem;
    background: rgba(0, 0, 0, 0.55);
}
.modal.show { display: flex; }
.modal-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
    max-width: 600px; width: 100%;
}
.modal-lg .modal-dialog { max-width: 800px; }

/* dfn-modal (vanilla, used by Risko) — matches modal style */
.dfn-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none; align-items: flex-start; justify-content: center;
    z-index: var(--z-modal); padding: 4rem 1rem 2rem;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}
.dfn-modal-backdrop.open { display: flex; animation: dfn-fadein 0.2s ease; }
.dfn-modal {
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    max-width: 720px; width: 100%;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--color-border);
    animation: dfn-popup 0.25s ease;
}
.dfn-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.dfn-modal-header h5 { margin: 0; font-size: var(--font-size-base); font-weight: 700; }
.dfn-modal-close {
    background: none; border: 0; color: var(--color-text-muted);
    cursor: pointer; padding: 0.2rem 0.5rem; line-height: 1; font-size: 1.5rem;
    border-radius: var(--radius-sm);
}
.dfn-modal-close:hover { background: var(--color-bg-hover); color: var(--color-text); }
.dfn-modal-body { padding: 1.25rem; }
.dfn-modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-border);
    display: flex; gap: 0.5rem; justify-content: flex-end;
    background: var(--color-bg);
}

@keyframes dfn-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes dfn-popup  { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ----- In-app toast notifications ----- */
#definium-toasts {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.dfn-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-info);
    border-radius: 10px;
    padding: 0.85rem 0.85rem 0.85rem 1rem;
    display: flex; align-items: flex-start; gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.dfn-toast.in  { opacity: 1; transform: none; }
.dfn-toast.out { opacity: 0; transform: translateX(20px); }
.dfn-toast > i {
    font-size: 1.25rem;
    line-height: 1.2;
    flex-shrink: 0;
    margin-top: 1px;
}
.dfn-toast-body { flex: 1; font-size: 0.9rem; line-height: 1.45; }
.dfn-toast-close {
    background: none;
    border: 0;
    font-size: 1.2rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    flex-shrink: 0;
}
.dfn-toast-close:hover { color: var(--color-text); }
.dfn-toast-success { border-left-color: var(--color-success); }
.dfn-toast-success > i { color: var(--color-success); }
.dfn-toast-warning { border-left-color: var(--color-warning); }
.dfn-toast-warning > i { color: var(--color-warning); }
.dfn-toast-error   { border-left-color: var(--color-danger); }
.dfn-toast-error   > i { color: var(--color-danger); }
.dfn-toast-info    > i { color: var(--color-info); }

/* ----- Stat-Value (legacy) ----- */
.stat-value { font-size: var(--font-size-3xl); font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--color-text-muted); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.04em; }

/* ----- Page Header ----- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header-content { flex: 1; min-width: 0; }
.page-title {
    font-size: var(--font-size-2xl);
    margin: 0 0 0.25rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.page-title i { color: var(--color-primary); }
.page-subtitle { color: var(--color-text-secondary); font-size: var(--font-size-sm); margin: 0; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ----- Module scope picker -----
   Zespół (/settings/team): grupa checkboxów zakresu modułowego Audytora
   (Faza 2.3, G-1). Fieldset z legendą .sr-only — wcześniej style inline. */
.module-scope-picker {
    max-height: 110px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 4px 10px;
    margin: 0;          /* reset domyślnych marginesów fieldset */
    min-width: 0;
}
.module-scope-picker label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: normal;
    cursor: pointer;
    white-space: nowrap;
}

/* =====================================================
   7. AUTH LAYOUT
   ===================================================== */
.auth-wrapper { min-height: 100vh; display: flex; }
.auth-left {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 2rem; background: var(--color-bg);
}
.auth-right {
    flex: 1;
    background: linear-gradient(135deg, #000000 0%, #1A1A1A 100%);
    display: none; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-right::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at center, rgba(255,199,0,0.10) 0%, transparent 60%);
}
@media (min-width: 1024px) { .auth-right { display: flex; } }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 2rem; }
.auth-logo-text {
    font-size: var(--font-size-xl); font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-logo-text span { color: var(--color-primary); }
.auth-title { font-size: var(--font-size-2xl); margin-bottom: 0.5rem; }
.auth-subtitle { color: var(--color-text-secondary); margin-bottom: 1.5rem; }
.auth-divider {
    display: flex; align-items: center; gap: 1rem;
    margin: 1.25rem 0;
    color: var(--color-text-muted); font-size: var(--font-size-sm);
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--color-border);
}
.auth-footer {
    text-align: center; margin-top: 1.25rem;
    font-size: var(--font-size-sm); color: var(--color-text-secondary);
}

/* =====================================================
   8. ANIMATIONS & HELPERS
   ===================================================== */
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fadein { animation: fadein 0.25s ease-out; }

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-help    { cursor: help; }
.user-select-none { user-select: none; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Skip-link (WCAG 2.4.1 — Bypass Blocks)
   Ukryty wizualnie (jak .sr-only) dopóki nie dostanie fokusu klawiaturą;
   wtedy „zjeżdża" w lewy górny róg jako widoczny przycisk i przenosi fokus
   do <main id="main-content" tabindex="-1">. Pierwszy fokusowalny element
   w <body> (dashboard.php), więc dostępny od razu po Tab. */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    z-index: 2000;
    padding: 0.6rem 1rem;
    border-radius: 0 0 8px 8px;
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transition: top var(--transition-fast);
}
.skip-link:focus {
    top: 0;
    color: var(--color-text-on-primary);
    outline: 3px solid var(--color-text);
    outline-offset: 2px;
}
/* main z tabindex=-1 nie ma pokazywać obrysu po przeskoku ze skip-linka */
#main-content:focus { outline: none; }

/* Print */
@media print {
    .sidebar, .navbar, .page-header-actions, .btn { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
}
