/* =====================================================================
   System EDU — ZDZ Kielce · system wyglądu
   Wszystkie kolory są tokenami (zmienne CSS) — motyw ciemny tylko je podmienia.
   Bootstrap 5.3 zostaje jako siatka i narzędzia; jego zmienne są mapowane na tokeny.
   ===================================================================== */

:root,
:root[data-theme="light"] {
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

    --bg:            #f5f6f8;
    --surface:       #ffffff;
    --surface-2:     #f9fafb;
    --surface-hover: #f2f4f7;
    --border:        #e5e7eb;
    --border-strong: #d4d8df;

    --text:        #0f172a;
    --text-muted:  #5b6475;
    --text-subtle: #8b93a3;

    --primary:        #2447d6;
    --primary-hover:  #1c3ab6;
    --primary-soft:   #eef2fe;
    --primary-fg:     #1d3aa6;
    --primary-ring:   rgba(36, 71, 214, .18);

    --success-soft: #ebfaf1;  --success-fg: #12733a;  --success: #16a34a;
    --warning-soft: #fff6e5;  --warning-fg: #9a4a07;  --warning: #f59e0b;
    --danger-soft:  #fef1f1;  --danger-fg:  #b42318;  --danger:  #dc2626;
    --neutral-soft: #f1f3f6;  --neutral-fg: #475467;  --neutral: #98a2b3;
    --violet-soft:  #f3efff;  --violet-fg:  #6338c9;  --violet:  #7c4dff;

    --gold: #d9a21b;

    --sidebar-bg:     #ffffff;
    --sidebar-border: #eceef2;
    --brand-from:     #1e3a8a;
    --brand-to:       #2f5bea;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 16px 40px -8px rgba(16, 24, 40, .18);

    --radius-sm: 8px;
    --radius:    10px;
    --radius-lg: 14px;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg:            #0b0d12;
    --surface:       #12151c;
    --surface-2:     #161a22;
    --surface-hover: #1b2029;
    --border:        #232834;
    --border-strong: #2f3543;

    --text:        #e8ebf1;
    --text-muted:  #a2aaba;
    --text-subtle: #6f7889;

    --primary:        #5b7cfa;
    --primary-hover:  #7290ff;
    --primary-soft:   rgba(91, 124, 250, .14);
    --primary-fg:     #aebfff;
    --primary-ring:   rgba(91, 124, 250, .30);

    --success-soft: rgba(34, 197, 94, .14);   --success-fg: #74e2a2;  --success: #22c55e;
    --warning-soft: rgba(245, 158, 11, .15);  --warning-fg: #fbc260;  --warning: #f59e0b;
    --danger-soft:  rgba(239, 68, 68, .15);   --danger-fg:  #fca5a5;  --danger:  #ef4444;
    --neutral-soft: rgba(148, 163, 184, .13); --neutral-fg: #cbd5e1;  --neutral: #64748b;
    --violet-soft:  rgba(139, 92, 246, .17);  --violet-fg:  #c8b8ff;  --violet:  #8b5cf6;

    --sidebar-bg:     #0e1117;
    --sidebar-border: #1d222c;

    --shadow-xs: none;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .45);
    --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, .6);

    color-scheme: dark;
}

/* ---------- Mapowanie na Bootstrap ---------- */
:root {
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: .875rem;
    --bs-body-line-height: 1.55;
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-subtle);
    --bs-border-color: var(--border);
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-hover);
    --bs-heading-color: var(--text);
    --bs-border-radius: var(--radius);
}
:root[data-theme] body { background: var(--bg); color: var(--text); }

* { -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-sans); font-feature-settings: "cv11", "ss01"; letter-spacing: -.003em; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.text-muted { color: var(--text-muted) !important; }
.text-subtle { color: var(--text-subtle) !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }
::selection { background: var(--primary-soft); color: var(--primary-fg); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* =====================================================================
   Szkielet aplikacji
   ===================================================================== */
.app { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: 264px; display: flex; flex-direction: column;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
    transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(140deg, var(--brand-from), var(--brand-to));
    box-shadow: inset 0 -2px 0 var(--gold), 0 4px 10px -2px rgba(36, 71, 214, .35);
}
.brand-name { font-weight: 650; font-size: .95rem; letter-spacing: -.01em; line-height: 1.2; color: var(--text); }
.brand-sub { font-size: .75rem; color: var(--text-subtle); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-group { margin-top: 14px; }
.nav-label {
    font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-subtle); padding: 0 10px 6px;
}
.nav-link-ui {
    position: relative; display: flex; align-items: center; gap: 10px;
    height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500; font-size: .875rem;
    transition: background .15s, color .15s;
}
.nav-link-ui svg { color: var(--text-subtle); flex-shrink: 0; transition: color .15s; }
.nav-link-ui:hover { background: var(--surface-hover); color: var(--text); }
.nav-link-ui:hover svg { color: var(--text-muted); }
.nav-link-ui.active { background: var(--primary-soft); color: var(--primary-fg); font-weight: 600; }
.nav-link-ui.active svg { color: var(--primary); }
.nav-link-ui.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.user-card {
    display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius);
}
.user-card:hover { background: var(--surface-hover); }
.user-card .name { font-size: .8125rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { font-size: .75rem; color: var(--text-subtle); }

.main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-crumbs { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--text-subtle); min-width: 0; }
.topbar-crumbs a { color: var(--text-muted); }
.topbar-crumbs a:hover { color: var(--text); }
.topbar-crumbs .current { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 28px 28px 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -.022em; line-height: 1.25; margin: 0; color: var(--text); }
.page-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: .875rem; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; color: var(--text-muted); margin-bottom: 8px; }
.back-link:hover { color: var(--text); }

.icon-btn {
    width: 36px; height: 36px; display: inline-grid; place-items: center; flex-shrink: 0;
    border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent;
    color: var(--text-muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); }

.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035;
        background: rgba(10, 13, 20, .45); backdrop-filter: blur(2px);
    }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px 40px; }
    .page-title { font-size: 1.3rem; }
}

/* =====================================================================
   Karty
   ===================================================================== */
.ui-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.ui-card + .ui-card { margin-top: 16px; }
.ui-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.ui-card-title { font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; margin: 0; color: var(--text); }
.ui-card-subtitle { font-size: .8125rem; color: var(--text-muted); margin: 2px 0 0; }
.ui-card-body { padding: 20px; }
.ui-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
a.ui-card { display: block; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.ui-card:hover, .ui-card.hoverable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* Statystyki */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; height: 100%; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: .8125rem; font-weight: 500; color: var(--text-muted); }
.stat-value { font-size: 1.875rem; font-weight: 650; letter-spacing: -.03em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-hint { font-size: .75rem; color: var(--text-subtle); }
.stat-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--t-soft); color: var(--t-fg); }

/* Tony (kolory semantyczne) */
.tone-primary { --t-soft: var(--primary-soft); --t-fg: var(--primary-fg); --t-solid: var(--primary); }
.tone-success { --t-soft: var(--success-soft); --t-fg: var(--success-fg); --t-solid: var(--success); }
.tone-warning { --t-soft: var(--warning-soft); --t-fg: var(--warning-fg); --t-solid: var(--warning); }
.tone-danger  { --t-soft: var(--danger-soft);  --t-fg: var(--danger-fg);  --t-solid: var(--danger); }
.tone-neutral { --t-soft: var(--neutral-soft); --t-fg: var(--neutral-fg); --t-solid: var(--neutral); }
.tone-violet  { --t-soft: var(--violet-soft);  --t-fg: var(--violet-fg);  --t-solid: var(--violet); }

/* Etykiety */
.tag {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    height: 24px; padding: 0 9px; border-radius: 999px;
    font-size: .75rem; font-weight: 550; line-height: 1;
    background: var(--t-soft, var(--neutral-soft)); color: var(--t-fg, var(--neutral-fg));
}
.tag-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--t-solid, currentColor); }
.tag-sq { border-radius: 6px; }
.tag-lg { height: 28px; padding: 0 12px; font-size: .8125rem; }
.tag-mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace; font-size: .7rem; letter-spacing: .02em; }

/* Awatar */
.avatar {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: center; font-size: .8125rem; font-weight: 650; letter-spacing: .01em;
    background: var(--t-soft, var(--primary-soft)); color: var(--t-fg, var(--primary-fg));
}
.avatar-sm { width: 30px; height: 30px; border-radius: 8px; font-size: .72rem; }
.avatar-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.15rem; }

/* Pasek zapełnienia */
.meter { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.meter-track { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-hover); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--t-solid, var(--primary)); transition: width .4s ease; }
.meter-label { font-size: .75rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Pasek segmentowy (statusy kursów) */
.segbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-hover); gap: 2px; }
.segbar > span { background: var(--t-solid); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-muted); }
.legend-item::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--t-solid); }
.legend-item strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Wiersze informacji (ikona + tekst) */
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; align-items: flex-start; gap: 10px; font-size: .875rem; color: var(--text-muted); }
.info-row svg { color: var(--text-subtle); flex-shrink: 0; margin-top: 2px; }
.info-row a { color: var(--text); }
.info-row a:hover { color: var(--primary); }

/* Pary etykieta / wartość */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 24px; }
.meta-grid.cols-1 { grid-template-columns: 1fr; }
.meta-label { font-size: .75rem; font-weight: 500; color: var(--text-subtle); margin-bottom: 3px; }
.meta-value { font-size: .9375rem; font-weight: 550; color: var(--text); }
.meta-value small { display: block; font-size: .8rem; font-weight: 400; color: var(--text-muted); margin-top: 1px; }

/* Lista z separatorami */
.stack-list > * + * { border-top: 1px solid var(--border); }
.stack-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
a.stack-item { color: inherit; }
a.stack-item:hover { background: var(--surface-2); }
.stack-item .title { font-weight: 550; color: var(--text); font-size: .875rem; }
.stack-item .sub { font-size: .78rem; color: var(--text-subtle); }

/* Kafelek liczby (mini) */
.mini-stats { display: flex; gap: 8px; }
.mini-stat { flex: 1; padding: 10px 12px; border-radius: var(--radius); background: var(--t-soft, var(--surface-2)); }
.mini-stat .v { font-size: 1.15rem; font-weight: 650; color: var(--t-fg, var(--text)); font-variant-numeric: tabular-nums; line-height: 1.1; }
.mini-stat .l { font-size: .72rem; color: var(--t-fg, var(--text-muted)); opacity: .85; }

/* Stan pusty */
.empty { text-align: center; padding: 48px 24px; }
.empty-icon {
    width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px;
    display: grid; place-items: center; background: var(--surface-hover); color: var(--text-subtle);
}
.empty-title { font-size: .9375rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-text { font-size: .8125rem; color: var(--text-muted); max-width: 380px; margin: 0 auto; }
.empty-actions { margin-top: 16px; display: flex; justify-content: center; gap: 8px; }

/* =====================================================================
   Tabele
   ===================================================================== */
.ui-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.ui-table thead th {
    position: sticky; top: 0;
    padding: 10px 16px; background: var(--surface-2);
    font-size: .75rem; font-weight: 550; color: var(--text-muted); text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.ui-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-muted); }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr { transition: background .12s; }
.ui-table tbody tr:hover { background: var(--surface-2); }
.ui-table th:first-child, .ui-table td:first-child { padding-left: 20px; }
.ui-table th:last-child, .ui-table td:last-child { padding-right: 20px; }
.ui-table .cell-main { color: var(--text); font-weight: 550; }
.ui-table .cell-main a { color: var(--text); }
.ui-table .cell-main a:hover { color: var(--primary); }
.ui-table .cell-sub { font-size: .78rem; color: var(--text-subtle); margin-top: 1px; }
.ui-table .cell-actions { text-align: right; white-space: nowrap; width: 1%; }
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.ui-card > .table-wrap:first-child { border-radius: var(--radius-lg); }
.ui-card > .table-wrap:first-child .ui-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.ui-card > .table-wrap:first-child .ui-table thead th:last-child { border-top-right-radius: var(--radius-lg); }

/* =====================================================================
   Przyciski (nadpisanie Bootstrap)
   ===================================================================== */
.btn {
    --bs-btn-font-size: .875rem; --bs-btn-font-weight: 550;
    --bs-btn-padding-y: .5rem; --bs-btn-padding-x: .95rem;
    --bs-btn-border-radius: var(--radius); --bs-btn-focus-box-shadow: 0 0 0 4px var(--primary-ring);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    white-space: nowrap; letter-spacing: -.005em;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-sm { --bs-btn-padding-y: .34rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; --bs-btn-border-radius: var(--radius-sm); }
.btn-primary {
    --bs-btn-color: #fff; --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-secondary, .btn-outline-secondary {
    --bs-btn-color: var(--text); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-hover); --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-hover); --bs-btn-active-border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-ghost {
    --bs-btn-color: var(--text-muted); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-hover); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-hover); --bs-btn-active-border-color: transparent;
}
.btn-soft-success {
    --bs-btn-color: var(--success-fg); --bs-btn-bg: var(--success-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--success); --bs-btn-hover-border-color: var(--success);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--success);
}
.btn-soft-danger {
    --bs-btn-color: var(--danger-fg); --bs-btn-bg: var(--danger-soft); --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--danger);
}
.btn-icon { --bs-btn-padding-x: 0; width: 34px; height: 34px; }
.btn-sm.btn-icon { width: 30px; height: 30px; }

/* Przełącznik widoku (kafelki / lista) */
.seg {
    display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius);
    background: var(--surface-hover); border: 1px solid var(--border);
}
.seg button, .seg a {
    height: 28px; min-width: 32px; padding: 0 8px; border: 0; border-radius: 7px;
    display: inline-grid; place-items: center; background: transparent; color: var(--text-subtle); cursor: pointer;
}
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* =====================================================================
   Filtry
   ===================================================================== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--surface-hover); border: 1px solid var(--border); flex-wrap: wrap; }
.chip {
    height: 30px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
    border-radius: 7px; font-size: .8125rem; font-weight: 500; color: var(--text-muted); white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.chip .count { font-size: .72rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.select-pill {
    height: 38px; padding: 0 34px 0 12px; border-radius: var(--radius);
    border: 1px solid var(--border); background-color: var(--surface); color: var(--text);
    font-size: .8125rem; font-weight: 500; max-width: 260px;
}
.search-input { position: relative; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.search-input .form-control { padding-left: 36px; }

/* =====================================================================
   Formularze
   ===================================================================== */
.form-label { font-size: .8125rem; font-weight: 550; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: .75rem; color: var(--text-subtle); margin-top: 5px; }
.form-control, .form-select {
    min-height: 40px; font-size: .875rem; color: var(--text);
    background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); background-color: var(--surface); color: var(--text); }
.form-control[readonly] { background: var(--surface-2); color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 88px; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.invalid-feedback { font-size: .78rem; color: var(--danger-fg); }
.form-check-input { border-color: var(--border-strong); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--primary-ring); border-color: var(--primary); }

.form-section + .form-section { margin-top: 16px; }
.form-grid { display: grid; gap: 18px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.form-narrow { max-width: 880px; margin: 0 auto; }
.form-narrow.sm { max-width: 720px; }

/* Lista wyboru (checkboxy w ramce) */
.check-list { border: 1px solid var(--border); border-radius: var(--radius); max-height: 300px; overflow-y: auto; background: var(--surface); }
.check-group-label { position: sticky; top: 0; z-index: 1; padding: 8px 14px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.check-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; font-size: .875rem; color: var(--text); }
.check-item + .check-item { border-top: 1px solid var(--border); }
.check-item:hover { background: var(--surface-2); }
.check-item .form-check-input { margin: 0; flex-shrink: 0; }
.check-item .grow { flex: 1; min-width: 0; }
.check-item.hidden { display: none; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.picked:not(:empty) { margin-bottom: 10px; }
.picked .tag button { border: 0; background: none; padding: 0; color: inherit; display: inline-grid; place-items: center; cursor: pointer; opacity: .7; }
.picked .tag button:hover { opacity: 1; }

/* =====================================================================
   Komunikaty
   ===================================================================== */
.callout {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
    background: var(--t-soft); color: var(--t-fg); font-size: .875rem; margin-bottom: 16px;
    border: 1px solid color-mix(in srgb, var(--t-fg) 18%, transparent);
}
.callout svg { flex-shrink: 0; margin-top: 1px; }
.callout ul { margin: 4px 0 0; padding-left: 18px; }

.toasts { position: fixed; top: 72px; right: 20px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast-ui {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px 12px 12px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); font-size: .875rem; animation: toast-in .3s ease both;
}
.toast-ui .toast-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--t-soft); color: var(--t-fg); }
.toast-ui .toast-body { flex: 1; padding-top: 3px; }
.toast-ui.hide { animation: toast-out .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) { .toast-ui, .toast-ui.hide { animation: none; } }

/* =====================================================================
   Stronicowanie
   ===================================================================== */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pager-info { font-size: .8125rem; color: var(--text-muted); }
.pager-info strong { color: var(--text); font-weight: 600; }
.pager-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pager-links a, .pager-links span {
    min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center;
    border-radius: var(--radius-sm); font-size: .8125rem; font-weight: 500; color: var(--text-muted);
    border: 1px solid var(--border); background: var(--surface); font-variant-numeric: tabular-nums;
}
.pager-links a:hover { color: var(--text); border-color: var(--border-strong); }
.pager-links .on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-links .off { opacity: .45; }
.pager-links .gap { border-color: transparent; background: none; }

/* =====================================================================
   Logowanie
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-aside {
    position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    background:
        radial-gradient(1200px 600px at -10% -20%, rgba(91, 124, 250, .55), transparent 60%),
        radial-gradient(800px 500px at 110% 120%, rgba(217, 162, 27, .28), transparent 60%),
        linear-gradient(160deg, #0d1b3f 0%, #10224f 55%, #0a1430 100%);
}
.auth-aside::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
    background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { font-size: 2.25rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 14px; max-width: 460px; color: #fff; }
.auth-aside p { color: rgba(255, 255, 255, .72); font-size: 1rem; max-width: 440px; margin: 0; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; color: rgba(255, 255, 255, .85); font-size: .9rem; }
.auth-feature .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); flex-shrink: 0; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -.025em; margin: 0 0 6px; }
.auth-logo { height: 44px; padding: 6px 12px; background: #fff; border-radius: 10px; display: inline-flex; align-items: center; box-shadow: var(--shadow-sm); }
.auth-logo img { height: 100%; width: auto; }
@media (max-width: 991.98px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

/* =====================================================================
   Drobne narzędzia
   ===================================================================== */
.gap-row { row-gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.prose-text { font-size: .9rem; line-height: 1.7; color: var(--text-muted); white-space: pre-line; margin: 0; }
.prose-list { margin: 0; padding-left: 1.15rem; font-size: .9rem; line-height: 1.65; color: var(--text-muted); }
.prose-list li + li { margin-top: 4px; }
.prose-list li::marker { color: var(--text-subtle); }
.sekcja + .sekcja { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.sekcja-tytul { font-size: .8125rem; font-weight: 600; color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sekcja-tytul svg { color: var(--text-subtle); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min-w-0 { min-width: 0; }
.fw-550 { font-weight: 550; }
.fw-600 { font-weight: 600; }
.is-hidden { display: none !important; }
.kbd-hint { font-size: .72rem; color: var(--text-subtle); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* ---------- Zgłoszenia ---------- */
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ui-table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.ui-table tr.is-new .cell-main a { font-weight: 700; }
.zg-akcje { display: flex; flex-wrap: wrap; gap: 8px; }
.zg-akcje .btn.on { pointer-events: none; opacity: .55; }
.zg-timeline { list-style: none; margin: 0; padding: 0; }
.zg-timeline li { position: relative; padding: 0 0 16px 22px; font-size: .84rem; color: var(--text-muted); }
.zg-timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--t-solid, var(--border-strong, #c4c9d4)); }
.zg-timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--border); }
.zg-timeline li:last-child::after { display: none; }
.zg-timeline .kiedy { display: block; font-size: .75rem; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.zg-timeline .co { color: var(--text); }
.zg-wiek { font-size: .75rem; color: var(--text-subtle); }
.zg-wiek.is-late { color: var(--danger, #c0392b); font-weight: 600; }
.popyt-liczba { font-size: 1.25rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
