/* =====================================================================
   EnterBHP Platforma Edukacyjna - arkusz stylów
   Styl: prosty, jasny, mobilny (inspiracja: mObywatel).
   Identyfikacja: zieleń EnterBHP (#008c39).

   Zasady, na których oparty jest ten arkusz:
     • jedna rzecz na ekranie jest najważniejsza - i ma być widoczna od razu,
     • duży tekst i duże pola dotyku (min. 44 px) - platformy używa się na telefonie,
     • mało ramek, dużo powietrza - treść niesie układ, nie linie,
     • na telefonie nawigacja jest na dole, w zasięgu kciuka.
   ===================================================================== */

:root {
    /* --- Marka --- */
    --brand:        #008c39;   /* zieleń EnterBHP - kolor główny */
    --brand-700:    #00631f;   /* wciśnięty */
    --brand-600:    #00722e;   /* najechany / tekst na jasnym tle */
    --brand-400:    #4caf72;
    --brand-200:    #a8dcbc;
    --brand-100:    #d7f0e1;
    --brand-050:    #eff9f2;   /* delikatny wypełniacz */
    --brand-tint:   rgba(0, 140, 57, .12);

    /* --- Neutralne --- */
    --bg:           #f4f6f5;
    --surface:      #ffffff;
    --surface-alt:  #fafbfa;
    --border:       #e3e7e4;
    --border-soft:  #eef1ef;
    --text:         #14181a;   /* wysoki kontrast - czytelność przede wszystkim */
    --text-soft:    #545d59;
    --text-mute:    #838d88;

    /* --- Statusy --- */
    --danger:       #c62828;
    --danger-bg:    #fdf3f3;
    --danger-brd:   #f3c9c9;
    --warning:      #a86a00;
    --warning-bg:   #fdf8ee;
    --warning-brd:  #f0dcb4;
    --info:         #1565c0;
    --info-bg:      #f0f6fd;
    --info-brd:     #c6dcf5;
    --success:      #008c39;
    --success-bg:   #eff9f2;

    /* --- Kształt i głębia --- */
    --radius:       18px;      /* karty */
    --radius-lg:    24px;      /* duże panele */
    --radius-sm:    12px;      /* pola, małe elementy */
    --radius-pill:  999px;

    /* Cienie w skali: im wyżej element „unosi się" nad tłem, tym większy numer.
       Każdy to dwie warstwy - wąski kontakt przy krawędzi i szeroka poświata -
       bo pojedyncze rozmycie wygląda płasko i brudno. */
    --shadow-1:     0 1px 2px rgba(16, 32, 24, .05);
    --shadow:       0 1px 2px rgba(16, 32, 24, .04), 0 4px 16px rgba(16, 32, 24, .05);
    --shadow-2:     0 2px 4px rgba(16, 32, 24, .05), 0 8px 24px rgba(16, 32, 24, .07);
    --shadow-lg:    0 8px 40px rgba(16, 32, 24, .10);
    --shadow-brand: 0 4px 14px rgba(0, 140, 57, .22);
    --ring:         0 0 0 4px var(--brand-tint);

    --sidebar-w:    264px;
    --bottom-nav-h: 68px;
    --tap:          44px;       /* minimalne pole dotyku */

    /* --- Ruch ---
       Trzy czasy trwania i trzy krzywe. Wszystko w interfejsie korzysta z tych
       zmiennych, dzięki czemu animacje wyglądają jak jeden system, a nie zbiór
       przypadkowych efektów. Zakres 120-420 ms: poniżej ruch jest niezauważalny,
       powyżej zaczyna spowalniać pracę.
       --ease-out    - wejścia: szybki start, miękkie wyhamowanie,
       --ease-spring - potwierdzenia: lekkie „przestrzelenie" celu,
       --ease-in-out - zmiany stanu w obie strony. */
    --dur-fast:     120ms;
    --dur:          200ms;
    --dur-slow:     420ms;
    --ease-out:     cubic-bezier(.22, .61, .36, 1);
    --ease-spring:  cubic-bezier(.34, 1.56, .64, 1);
    --ease-in-out:  cubic-bezier(.4, 0, .2, 1);

    --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono:    ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 16.5px;          /* czytelne bez powiększania */
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; font-weight: 800; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }

/* Widoczny focus dla klawiatury - wymóg dostępności, nie ozdoba. */
:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- Przyciski ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: var(--tap);
    padding: .7rem 1.35rem;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition:
        background var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out),
        box-shadow var(--dur) var(--ease-out),
        transform var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
/* Wciśnięcie: przycisk „siada" i traci cień - palec czuje reakcję. */
.btn:active { transform: translateY(1px) scale(.985); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-600); color: #fff; box-shadow: 0 6px 20px rgba(0, 140, 57, .3); }
.btn-primary:active { background: var(--brand-700); box-shadow: var(--shadow-1); }

.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-600); background: var(--brand-050); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(198, 40, 40, .22); }
.btn-danger:hover { background: #a71d1d; color: #fff; }

.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: .4rem .9rem; font-size: .9rem; }

/* Przycisk w trakcie wysyłania formularza - kręcące się kółko zamiast treści.
   Blokada podwójnego kliknięcia jest w app.js; tu tylko jej oprawa. */
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    color: #fff;
    animation: spin .7s linear infinite;
}
.btn-outline.is-busy::after { color: var(--brand); }

/* ---------- Formularze ---------- */
.field { margin-bottom: 1.15rem; }
.field label {
    display: block;
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .4rem;
}
.input {
    width: 100%;
    min-height: var(--tap);
    padding: .7rem .9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: var(--brand-200); }
.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}
.input::placeholder { color: var(--text-mute); }
.input-hint { font-size: .87rem; color: var(--text-soft); margin-top: .35rem; }

select.input { appearance: auto; }
textarea.input { min-height: 120px; resize: vertical; }

.field .field-error { color: var(--danger); font-size: .87rem; font-weight: 600; margin-top: .35rem; }
.input.has-error { border-color: var(--danger); }
.input.has-error:focus { box-shadow: 0 0 0 4px rgba(198, 40, 40, .12); }

.checkbox-row { display: flex; align-items: center; gap: .65rem; margin: .5rem 0 1rem; }
.checkbox-row input { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }
.checkbox-row label { margin: 0; cursor: pointer; }

.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.form-card { max-width: 680px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Alerty ---------- */
.alert {
    display: flex;
    gap: .6rem;
    padding: .95rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.15rem;
    font-size: .97rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-left-width: 5px;
}
/* Komunikat wjeżdża z góry - wzrok wraca na niego po przeładowaniu strony. */
.alert { animation: alert-in var(--dur-slow) var(--ease-spring); }
.alert.is-leaving { animation: alert-out var(--dur) var(--ease-in-out) forwards; }
.alert-error   { background: var(--danger-bg);  color: #8c1c1c; border-color: var(--danger-brd);  border-left-color: var(--danger); }
.alert-success { background: var(--success-bg); color: #0a5c2a; border-color: var(--brand-100);   border-left-color: var(--brand); }
.alert-info    { background: var(--info-bg);    color: #10457f; border-color: var(--info-brd);    border-left-color: var(--info); }
.alert-warning { background: var(--warning-bg); color: #7a4d00; border-color: var(--warning-brd); border-left-color: var(--warning); }

/* ---------- Ekran logowania ---------- */
.auth-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background:
        radial-gradient(1100px 480px at 100% -10%, rgba(0, 140, 57, .10), transparent 60%),
        radial-gradient(900px 520px at -10% 110%, rgba(0, 140, 57, .07), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2rem;
}
.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand img { height: 72px; width: auto; }
.auth-brand .name { font-weight: 800; font-size: 1.1rem; color: var(--text); margin-top: .65rem; }
.auth-brand .sub  { color: var(--text-soft); font-size: .92rem; margin-top: .15rem; }
.auth-title { text-align: center; margin-bottom: 1.5rem; font-size: 1.35rem; }
.auth-foot { text-align: center; margin-top: 1.5rem; font-size: .95rem; color: var(--text-soft); }

@media (max-width: 480px) {
    .auth-card { padding: 1.75rem 1.25rem; border-radius: var(--radius); }
}

/* ---------- Układ aplikacji ---------- */
.layout { display: flex; min-height: 100vh; }

/* Menu boczne - jasne, spokojne; wyróżnia się tylko aktywna pozycja. */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
}
.sidebar .logo {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--border-soft);
    min-height: 76px;
}
.sidebar .logo img { height: 40px; width: auto; }
.sidebar .logo span { font-weight: 800; color: var(--text); font-size: 1.05rem; letter-spacing: -.02em; }

.sidebar nav { padding: 1rem .85rem; flex: 1; overflow-y: auto; }
.sidebar .nav-section {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-mute);
    font-weight: 800;
    padding: .85rem .8rem .45rem;
}
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: var(--tap);
    padding: .65rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .2rem;
    position: relative;
    transition:
        background var(--dur) var(--ease-out),
        color var(--dur) var(--ease-out),
        padding-left var(--dur) var(--ease-out);
}
/* Najechanie przesuwa pozycję o kilka pikseli w prawo - ruch prowadzi wzrok
   w stronę treści, do której pozycja prowadzi. */
.sidebar a.nav-item:hover {
    background: var(--surface-alt);
    color: var(--text);
    text-decoration: none;
    padding-left: 1.05rem;
}
.sidebar a.nav-item.active {
    background: linear-gradient(100deg, var(--brand) 0%, var(--brand-600) 100%);
    color: #fff;
    box-shadow: var(--shadow-brand);
    padding-left: .8rem;
}
.sidebar a.nav-item.active .nav-icon { opacity: 1; }
/* Pionowy znacznik przy aktywnej pozycji - wjeżdża od lewej. */
.sidebar a.nav-item.active::before {
    content: '';
    position: absolute;
    left: -.85rem;
    top: 50%;
    width: 4px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: var(--brand-700);
    transform: translateY(-50%);
    animation: nav-marker var(--dur) var(--ease-out);
}
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    opacity: .75;
    transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.sidebar a.nav-item:hover .nav-icon { opacity: 1; transform: scale(1.08); }
.nav-icon svg { width: 22px; height: 22px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    min-height: 76px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.75rem;
    position: sticky;
    top: 0;
    z-index: 30;
    transition: box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
/* Klasę dokłada app.js po przewinięciu - pasek odrywa się wtedy od treści. */
.topbar.is-scrolled { box-shadow: var(--shadow-2); }

/* Przeglądarki bez color-mix dostają pełne, nieprzezroczyste tło. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .topbar { background: var(--surface); }
}
.topbar .page-title { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.topbar-left { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.topbar-logo { display: none; height: 34px; width: auto; }

.user-menu { display: flex; align-items: center; gap: .8rem; }
.user-badge {
    display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25;
    text-decoration: none; color: inherit;
}
.user-badge:hover { text-decoration: none; }
.user-badge:hover .u-name { color: var(--brand-700); }
.user-badge .u-name { font-weight: 700; font-size: .95rem; }
.user-badge .u-role { font-size: .8rem; color: var(--text-mute); font-weight: 500; }
.avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--brand-100); color: var(--brand-700);
    display: grid; place-items: center; font-weight: 800; font-size: .95rem;
    flex: 0 0 44px;
    text-decoration: none;
    transition: background .15s;
}
a.avatar:hover { background: var(--brand-200); text-decoration: none; }

/* Dzwonek powiadomień w topbarze */
.notif-bell {
    position: relative; width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center; color: var(--text-soft);
    text-decoration: none; transition: background .15s, color .15s;
}
.notif-bell:hover { background: var(--brand-050); color: var(--brand-700); }
.notif-bell svg { width: 22px; height: 22px; }
.notif-bell.has-unread { color: var(--brand-700); }
.notif-badge {
    position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px;
    padding: 0 4px; border-radius: 9px; background: #e11d48; color: #fff;
    font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center;
}

.content { padding: 1.75rem; max-width: 1180px; width: 100%; }

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--tap); height: var(--tap);
    background: none; border: none; cursor: pointer; color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0;
}
.menu-toggle:hover { background: var(--surface-alt); }
.menu-toggle svg { width: 26px; height: 26px; }

/* Przyciemnienie tła przy otwartym menu na telefonie */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10, 20, 15, .45);
    z-index: 35;
}
.sidebar-backdrop.show { display: block; }

/* ---------- Nawigacja dolna (telefon) ---------- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 45;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner { display: flex; }
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    min-height: var(--bottom-nav-h);
    padding: .5rem .25rem;
    color: var(--text-mute);
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    line-height: 1.2;
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a { position: relative; transition: color var(--dur) var(--ease-out); }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav .nav-icon {
    width: 26px; height: 26px; flex: 0 0 26px; opacity: 1;
    transition: transform var(--dur) var(--ease-spring);
}
.bottom-nav .nav-icon svg { width: 25px; height: 25px; }
.bottom-nav a.active .nav-icon { color: var(--brand); transform: translateY(-2px); }
/* Kreska nad aktywną pozycją - rozsuwa się od środka. */
.bottom-nav a.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    width: 28px; height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--brand);
    transform: translateX(-50%) scaleX(0);
    animation: bottom-marker var(--dur) var(--ease-out) forwards;
}
.bottom-nav a:active .nav-icon { transform: scale(.88); }

/* ---------- Karty / kafelki ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}

/* Kafelek liczbowy: cienki pasek marki u góry i duża, wyrównana cyfra. */
.stat { position: relative; overflow: hidden; }
.stat::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-400));
    transform: scaleX(0);
    transform-origin: left;
    animation: stat-bar var(--dur-slow) var(--ease-out) forwards;
}
.stat:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.stat .stat-value {
    font-size: 2.4rem; font-weight: 800; color: var(--brand);
    line-height: 1.1; letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;  /* liczba nie „skacze" przy odliczaniu */
}
.stat .stat-label { color: var(--text-soft); font-size: .95rem; font-weight: 600; margin-top: .15rem; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem;
}
.panel-success { border-color: var(--brand-200); background: var(--brand-050); }

/* Panel powitalny na stronie głównej - delikatna poświata marki w rogu,
   żeby pierwszy ekran po zalogowaniu nie był płaską białą płytą. */
.panel.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(620px 200px at 100% 0%, rgba(0, 140, 57, .09), transparent 70%),
        var(--surface);
    border-color: var(--brand-100);
}
.panel.hero h1 { margin-bottom: .35rem; }

/* Akapit wprowadzający pod nagłówkiem strony. */
.lede { color: var(--text-soft); margin: -.5rem 0 1.25rem; max-width: 68ch; }
.muted { color: var(--text-mute); }
.muted-sm { color: var(--text-soft); font-size: .85rem; }
.mini-label { font-weight: 600; font-size: .85rem; color: var(--text-soft); }
.pill-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.badge {
    display: inline-block; padding: .2rem .7rem; border-radius: var(--radius-pill);
    font-size: .8rem; font-weight: 700; background: var(--brand-100); color: var(--brand-700);
}

/* ---------- Pasek narzędzi ---------- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.toolbar h1 { margin: 0; }
.toolbar .toolbar-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.15rem; }
.filters .input, .filters select { width: auto; min-width: 170px; }

/* ---------- Tabele ---------- */
.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
table.table { width: 100%; border-collapse: collapse; font-size: .96rem; }
table.table th, table.table td {
    padding: .95rem 1.15rem; text-align: left;
    border-bottom: 1px solid var(--border-soft); vertical-align: middle;
}
table.table th {
    background: var(--surface-alt); color: var(--text-soft);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800;
    white-space: nowrap;
}
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
table.table tbody tr:hover td { background: var(--brand-050); }
/* Wiersz zalogowanego kursanta w rankingu. */
table.table tbody tr.is-me td { background: var(--brand-050); font-weight: 700; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }

/* Znaczniki statusu */
.pill {
    display: inline-block; padding: .22rem .7rem; border-radius: var(--radius-pill);
    font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.pill-on   { background: var(--brand-100); color: var(--brand-700); }
.pill-off  { background: #fde8e8; color: #8c1c1c; }
.pill-warn { background: #fef3c7; color: #92600a; }

/* Lista powiadomień */
.notif-list { display: flex; flex-direction: column; gap: .6rem; }
.notif-item {
    display: flex; align-items: center; gap: 1rem; justify-content: space-between;
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: .85rem 1.1rem;
}
.notif-item.unread { border-left: 4px solid var(--brand); background: var(--brand-050); }
.notif-title { font-weight: 700; }
.notif-body { color: var(--text-soft); font-size: .9rem; margin-top: .15rem; }
.notif-time { color: var(--text-mute); font-size: .78rem; margin-top: .25rem; }
.notif-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* Edytor treści (WYSIWYG) */
.wysiwyg { border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.wysiwyg-toolbar {
    display: flex; flex-wrap: wrap; gap: .3rem; padding: .45rem;
    background: var(--surface-alt); border-bottom: 1px solid var(--border);
}
.wysiwyg-btn {
    border: 1px solid var(--border); background: var(--surface); border-radius: 6px;
    padding: .28rem .6rem; font-size: .85rem; line-height: 1.2; cursor: pointer; color: var(--text);
}
.wysiwyg-btn:hover { background: var(--brand-050); border-color: var(--brand-400); }
.wysiwyg-area { min-height: 220px; padding: .85rem 1rem; outline: none; }
.wysiwyg-area:focus { outline: none; }
.wysiwyg-area h2 { font-size: 1.25rem; margin: .7rem 0 .35rem; }
.wysiwyg-area h3 { font-size: 1.08rem; margin: .55rem 0 .3rem; }
.wysiwyg-area ul, .wysiwyg-area ol { margin: .4rem 0 .4rem 1.4rem; }
.wysiwyg-area p { margin: .5rem 0; }

/* Bramka czasu lekcji */
.lesson-gate-note { display: block; color: var(--text-mute); font-size: .85rem; margin-top: .4rem; }

/* Wykresy (inline-SVG) */
.chart-card { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.chart-donut { width: 160px; height: 160px; flex-shrink: 0; }
.chart-donut-top { font-size: 20px; font-weight: 800; fill: var(--text); }
.chart-donut-sub { font-size: 8px; fill: var(--text-mute); }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.chart-legend li { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-soft); }
.chart-legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.chart-bars { display: flex; flex-direction: column; gap: .55rem; }
.chart-bar-row { display: grid; grid-template-columns: minmax(120px, 1.5fr) 3fr auto; align-items: center; gap: .75rem; }
.chart-bar-label { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-track { height: 12px; background: #eef1ef; border-radius: 999px; overflow: hidden; }
.chart-bar-fill { display: block; height: 100%; border-radius: 999px; }
.chart-bar-value { font-size: .82rem; color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) { .chart-bar-row { grid-template-columns: 1fr; gap: .2rem; } }

/* Zakładki ustawień */
.settings-tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--border-soft); margin-bottom: 1.25rem; }
.settings-tab {
    padding: .6rem 1.1rem; text-decoration: none; color: var(--text-soft);
    border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600;
}
.settings-tab:hover { color: var(--brand-700); text-decoration: none; }
.settings-tab.active { color: var(--brand-700); border-bottom-color: var(--brand); }

/* Kroki ścieżki szkoleniowej */
.path-steps { display: flex; flex-direction: column; gap: .6rem; }
.path-step {
    display: flex; align-items: center; gap: 1rem;
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: .85rem 1.1rem;
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.path-step:hover { box-shadow: var(--shadow-2); transform: translateX(3px); }
.path-step.is-done { border-left: 4px solid var(--brand); background: var(--brand-050); }
.path-step-num {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: var(--brand-100); color: var(--brand-700);
    display: grid; place-items: center; font-weight: 800;
    transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.path-step.is-done .path-step-num { background: var(--brand); color: #fff; }
.path-step-body { flex: 1; min-width: 0; }
.path-step-title { font-weight: 700; }
.path-step-meta { font-size: .82rem; color: var(--text-mute); margin-top: .15rem; }

/* Odznaki (gamifikacja) */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.badge-tile {
    text-align: center; padding: 1rem .75rem; border: 1px solid var(--border-soft);
    border-radius: var(--radius); background: var(--surface);
    transition:
        transform var(--dur) var(--ease-spring),
        box-shadow var(--dur) var(--ease-out),
        border-color var(--dur) var(--ease-out),
        opacity var(--dur) var(--ease-out),
        filter var(--dur) var(--ease-out);
}
.badge-tile:not(.is-locked):hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2);
    border-color: var(--brand-200);
}
.badge-tile.is-locked { opacity: .5; filter: grayscale(1); }
/* Najechanie na zablokowaną odznakę pokazuje, jak będzie wyglądać po zdobyciu -
   drobna zachęta, żeby dokończyć kurs. */
.badge-tile.is-locked:hover { opacity: .78; filter: grayscale(.45); }
.badge-icon {
    font-size: 2.4rem; line-height: 1; display: inline-block;
    transition: transform var(--dur) var(--ease-spring);
}
.badge-tile:not(.is-locked):hover .badge-icon { transform: scale(1.15) rotate(-6deg); }
.badge-name { font-weight: 700; margin-top: .4rem; }
.badge-desc { font-size: .82rem; color: var(--text-soft); margin-top: .2rem; }
.badge-when { font-size: .74rem; color: var(--text-mute); margin-top: .4rem; }

/* Wyjaśnienie pytania w przeglądzie wyniku testu */
.review-explanation {
    margin-top: .6rem; padding: .6rem .85rem; border-radius: var(--radius-sm);
    background: var(--brand-050); color: var(--text-soft);
    border-left: 3px solid var(--brand-400, var(--brand)); font-size: .9rem;
}
.pill-role { background: #eaeefb; color: #2b3a86; }
.pill-mono {
    font-family: var(--font-mono); background: var(--brand-050);
    color: var(--brand-700); border: 1px dashed var(--brand-400); letter-spacing: .04em;
}

/* ---------- Pusty stan ---------- */
.empty-state { text-align: center; padding: 3.5rem 1.25rem; color: var(--text-soft); }
.empty-state .icon {
    font-size: 3rem; opacity: .55; margin-bottom: .5rem;
    display: inline-block;
    animation: float-soft 4s var(--ease-in-out) infinite;
}
.empty-state p { margin: 0 auto; max-width: 460px; }

/* ---------- Blok informacyjny ---------- */
.note-box {
    background: var(--brand-050); border: 1px solid var(--brand-100);
    border-radius: var(--radius-sm); padding: 1.15rem; margin-bottom: 1.15rem; font-size: .95rem;
}
.cred-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.cred-table th, .cred-table td { padding: .5rem .65rem; border-bottom: 1px solid var(--border); text-align: left; }
.cred-table td.mono { font-family: var(--font-mono); }

/* ---------- Kreator kursu ---------- */
.builder { display: flex; flex-direction: column; gap: 1rem; }
.module-card {
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.25rem 1.35rem; margin-bottom: 1rem;
}
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.module-title { font-weight: 800; font-size: 1.1rem; }
.module-actions { display: flex; gap: .35rem; }
.module-actions form { margin: 0; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-soft);
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: .9rem; line-height: 1; font-family: inherit;
    transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand-600); background: var(--brand-050); }
.icon-btn.icon-danger:hover { border-color: var(--danger-brd); color: var(--danger); background: var(--danger-bg); }

.lesson-list { list-style: none; margin: .9rem 0; padding: 0; }
.lesson-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem .9rem; border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm); margin-bottom: .5rem;
    background: var(--surface-alt);
}
/* flex: 1 jest tu konieczne. Ta sama lista (<ul class="lesson-list">) niesie
   w widoku kursanta wiersze .lesson-row, a nadrzędna reguła .lesson-list li
   ustawia justify-content: space-between. Bez rozciągnięcia opisu tytuł lekcji
   zawisał na środku wiersza, oderwany od znacznika ukończenia po lewej. */
.lesson-info { min-width: 0; flex: 1; }
.lesson-title { font-weight: 700; }
.lesson-meta { display: block; font-size: .85rem; color: var(--text-mute); margin-top: .1rem; }
.lesson-actions { display: flex; gap: .35rem; align-items: center; }
.lesson-actions form { margin: 0; }
.lesson-empty { color: var(--text-mute); font-style: italic; margin: .5rem 0; }

details.add-inline { margin-top: .65rem; }
details.add-inline summary {
    cursor: pointer; color: var(--brand-600); font-size: .95rem; font-weight: 700;
    display: inline-block; padding: .4rem 0; user-select: none;
}
.inline-form { display: flex; gap: .6rem; margin-top: .65rem; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 220px; }

/* ---------- Materiały osadzone ---------- */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); }
.video-embed iframe, .video-embed video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Strony błędów ---------- */
/* Układ pionowy: treść wypełnia ekran, belka dofinansowania zostaje na dole. */
.error-layout { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.error-page {
    flex: 1;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(900px 420px at 100% -10%, rgba(0, 140, 57, .08), transparent 60%),
        var(--bg);
}
.error-box {
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    animation: rise var(--dur-slow) var(--ease-out) both;
}
.error-logo { height: 56px; width: auto; opacity: .9; margin-bottom: .5rem; }
.error-code {
    font-size: 4.5rem; font-weight: 800; color: var(--brand);
    line-height: 1; letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
}
.error-title { font-size: 1.35rem; margin: .35rem 0 1rem; }
.error-text p { margin: 0 0 .75rem; color: var(--text-soft); }
/* Podpowiedź „dlaczego to się stało" - drobniejsza, żeby nie konkurowała z komunikatem. */
.error-hint { font-size: .92rem; color: var(--text-mute) !important; }
.error-actions {
    display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center;
    margin-top: 1.5rem;
}
.error-layout .funding { background: none; border-top: 1px solid var(--border); }

@media (max-width: 480px) {
    .error-box { padding: 1.75rem 1.25rem; border-radius: var(--radius); }
    .error-code { font-size: 3.5rem; }
    .error-actions .btn { width: 100%; }
}

/* ---------- Pomocnicze ---------- */
.txt-mute { color: var(--text-mute); }
.txt-ok   { color: var(--success); font-weight: 700; }
.txt-bad  { color: var(--danger); font-weight: 700; }
[hidden]  { display: none !important; }

/* ---------- Pasek postępu ---------- */
.progress { height: 12px; background: var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.progress-thin { height: 6px; }
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-400), var(--brand));
    border-radius: var(--radius-pill);
    transition: width var(--dur-slow) var(--ease-out);
    position: relative;
}
/* Pasek ukończony w 100% dostaje jednorazowy przebłysk. */
.progress-bar.is-done { background: linear-gradient(90deg, var(--brand), var(--brand-600)); }
.progress-bar.is-done::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    animation: shine 1.6s var(--ease-out) .3s;
}
.progress-meta {
    display: flex; justify-content: space-between; gap: 1rem;
    margin-top: .5rem; font-size: .88rem; color: var(--text-soft); font-weight: 600;
}
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .85rem; flex-wrap: wrap; }

/* ---------- Siatka kursów ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.course-card {
    display: flex; flex-direction: column; justify-content: space-between;
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    transition: box-shadow .18s, transform .18s;
}
.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.course-card-body { padding: 1.4rem; }
.course-card-title { font-size: 1.12rem; margin: 0 0 .5rem; line-height: 1.35; }
.course-card-desc { color: var(--text-soft); font-size: .93rem; margin: 0 0 1.15rem; }
.course-card-due { margin: .85rem 0 0; font-size: .88rem; color: var(--text-soft); font-weight: 600; }
.course-card-due.is-late { color: var(--danger); }
.course-card-foot {
    display: flex; gap: .6rem; padding: 1rem 1.4rem;
    background: var(--surface-alt); border-top: 1px solid var(--border-soft);
}

/* ---------- Okruszki ---------- */
.lesson-crumbs { color: var(--text-mute); font-size: .9rem; margin: -.35rem 0 1.15rem; font-weight: 600; }

/* ---------- Spis lekcji ---------- */
.lesson-row {
    display: flex; align-items: center; gap: 1rem;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-soft);
    min-height: 60px;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row.is-done { background: var(--brand-050); }
.lesson-check {
    flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 800; background: var(--border); color: var(--text-mute);
}
.lesson-row.is-done .lesson-check { background: var(--brand); color: #fff; }

/* ---------- Treść lekcji ---------- */
.lesson-content { line-height: 1.75; font-size: 1.05rem; }
.lesson-content h2 { font-size: 1.3rem; margin: 1.75rem 0 .7rem; color: var(--brand-700); }
.lesson-content h2:first-child { margin-top: 0; }
.lesson-content h3 { font-size: 1.1rem; margin: 1.35rem 0 .55rem; }
.lesson-content p { margin: 0 0 1rem; color: var(--text-soft); }
.lesson-content ul, .lesson-content ol { margin: 0 0 1rem 1.4rem; color: var(--text-soft); }
.lesson-content li { margin-bottom: .45rem; }
.lesson-content blockquote {
    margin: 0 0 1rem; padding: .85rem 1.15rem;
    border-left: 4px solid var(--brand-400);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--brand-050); color: var(--text-soft);
}

/* ---------- Materiały ---------- */
.material-list { list-style: none; margin: 1.15rem 0 0; padding: 0; }
.material-row {
    display: flex; align-items: center; gap: 1rem;
    padding: .85rem 0; border-bottom: 1px solid var(--border-soft);
}
.material-row:last-child { border-bottom: none; }
.material-icon { font-size: 1.5rem; flex: 0 0 auto; }
.material-info { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.material-title { font-weight: 700; font-size: .97rem; }
.material-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.material-embed { padding: 1rem 0 1.35rem; border-bottom: 1px solid var(--border-soft); }
.video-file { width: 100%; border-radius: var(--radius); background: #000; }

/* ---------- Nawigacja lekcji ---------- */
.lesson-nav {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center;
    margin-top: 1.75rem; padding: 1.25rem; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lesson-nav-main { display: flex; align-items: center; gap: .7rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Kreator testu ---------- */
.test-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.15rem; font-size: .97rem;
}
.test-summary .txt-mute { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }

.answer-list { list-style: none; margin: 0; padding: .5rem 1.25rem 1.15rem; }
.answer-item { display: flex; gap: .65rem; padding: .4rem 0; font-size: .95rem; color: var(--text-soft); }
.answer-item.is-correct { color: var(--success); font-weight: 700; }

.answer-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.answer-correct { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--brand); cursor: pointer; }
.answer-row .input { flex: 1; }

.rules-list { margin: .9rem 0 0 1.3rem; color: var(--text-soft); line-height: 2; }

/* ---------- Rozwiązywanie testu ---------- */
.test-timer {
    font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem;
    padding: .55rem 1rem; border-radius: var(--radius-pill);
    background: var(--brand-050); color: var(--brand-700); border: 2px solid var(--brand-100);
    white-space: nowrap;
}
.test-timer.is-urgent {
    background: var(--danger-bg); color: var(--danger); border-color: var(--danger);
    animation: pulse 1s var(--ease-in-out) infinite;
}
/* Wyłączenie ruchu dla osób, które o to poprosiły w systemie - zbiorczo
   na końcu arkusza, w sekcji „Ograniczony ruch". */

.question-card { margin-bottom: 1.35rem; }
.question-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .85rem; }
.question-no {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-mute); font-weight: 800;
}
.question-tags { display: flex; gap: .45rem; flex-wrap: wrap; }
.question-text { font-size: 1.12rem; font-weight: 700; margin: 0 0 1.15rem; line-height: 1.45; }

.option-list { list-style: none; margin: 0; padding: 0; }
.option-list li { margin-bottom: .6rem; }
.option {
    display: flex; align-items: center; gap: .85rem;
    min-height: var(--tap);
    padding: .85rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: background .15s, border-color .15s;
    font-size: 1rem;
}
.option:hover { background: var(--brand-050); border-color: var(--brand-400); }
.option:has(input:checked) { background: var(--brand-050); border-color: var(--brand); }
.option input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--brand); cursor: pointer; }
.option-list.is-review .option { cursor: default; }
.option-list.is-review .option:hover { background: none; border-color: var(--border); }
.option.is-correct { background: var(--success-bg); border-color: var(--success); }
.option.is-wrong { background: var(--danger-bg); border-color: var(--danger); }

/* ---------- Wynik ---------- */
.result-panel { text-align: center; padding: 2.5rem 1.75rem; }
.result-panel.is-pass { border-color: var(--brand-200); background: var(--success-bg); }
.result-panel.is-fail { border-color: var(--danger-brd); background: var(--danger-bg); }
.result-badge {
    width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: #fff;
}
.result-panel.is-pass .result-badge { background: var(--success); }
.result-panel.is-fail .result-badge { background: var(--danger); }
.result-score { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.result-panel.is-pass .result-score { color: var(--success); }
.result-panel.is-fail .result-score { color: var(--danger); }
.result-verdict { font-size: 1.2rem; font-weight: 800; margin-top: .5rem; }
.result-meta { color: var(--text-soft); font-size: .92rem; margin: .7rem 0 0; }

.review-question { padding: 1.15rem 0; border-bottom: 1px solid var(--border-soft); }
.review-question:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.review-head strong { flex: 1; font-weight: 700; }
.review-mark {
    flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800;
}
.review-mark.is-ok { background: var(--success); }
.review-mark.is-bad { background: var(--danger); }

/* ---------- Certyfikaty ---------- */
.cert-card {
    position: relative; padding: 1.6rem; background: var(--surface);
    border: 1px solid var(--brand-100); border-top: 5px solid var(--brand);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.cert-ribbon { position: absolute; top: 1.15rem; right: 1.35rem; font-size: 1.8rem; }
.cert-title { font-size: 1.08rem; margin: 0 2.5rem .95rem 0; line-height: 1.4; }
.cert-meta { margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.cert-meta div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.cert-meta dt { color: var(--text-mute); margin: 0; }
.cert-meta dd { margin: 0; font-weight: 700; text-align: right; }
.cert-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Skróty w panelu ---------- */
.shortcut-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem; margin-top: 1.15rem;
}
.shortcut {
    display: flex; flex-direction: column; gap: .3rem; padding: 1.25rem;
    border: 2px solid var(--border-soft); border-radius: var(--radius);
    background: var(--surface);
    text-decoration: none; color: inherit;
    transition: border-color .15s, background .15s, transform .15s;
}
.shortcut:hover {
    border-color: var(--brand); background: var(--brand-050);
    text-decoration: none; transform: translateY(-2px);
}
.shortcut-title { font-weight: 800; color: var(--brand-700); font-size: 1.05rem; }
.shortcut-desc { font-size: .9rem; color: var(--text-soft); font-weight: 500; }

/* =====================================================================
   Responsywność - telefon dostaje nawigację dolną, menu boczne chowa się
   ===================================================================== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar-logo { display: block; }
    .topbar .page-title { display: none; }   /* na wąskim ekranie liczy się treść, nie tytuł */
    .topbar { padding: .65rem 1rem; min-height: 64px; }
    .user-badge { display: none; }           /* awatar wystarczy */
    .content { padding: 1.15rem 1rem; }

    .bottom-nav { display: block; }
    /* Miejsce na pasek dolny, żeby nie zasłaniał treści. */
    .main { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
    h1 { font-size: 1.5rem; }
    .lesson-nav { grid-template-columns: 1fr; }
    .lesson-nav > div { text-align: center !important; }
    .question-head { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
    .card { padding: 1.15rem; }
    .stat .stat-value { font-size: 2rem; }
    .panel { padding: 1.25rem; }
    .course-grid { grid-template-columns: 1fr; }
    .toolbar { gap: .75rem; }
    .toolbar .toolbar-actions { width: 100%; }
    .toolbar .toolbar-actions .btn { flex: 1; }
    .result-score { font-size: 2.8rem; }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    /* Akcje w tabelach schodzą pod spód zamiast rozpychać wiersz. */
    .row-actions { justify-content: flex-start; }
}

/* =====================================================================
   Belka dofinansowania (oznaczenie unijne)
   ---------------------------------------------------------------------
   Musi być widoczna na każdym ekranie, także przed zalogowaniem, dlatego
   siedzi w stopce obu układów. Zasady doboru stylu:
     • własne, jasne tło - znaki mają ustalone kolory i wymagają spokojnego,
       neutralnego otoczenia; nie kładziemy ich na zieleni marki,
     • grafika skaluje się do szerokości treści, ale nie rozciąga ponad
       swój rozmiar naturalny (1390 px), żeby nie rozmyć znaków,
     • pozostaje na wydruku - oznaczenie obowiązuje też na papierze.
   ===================================================================== */
.funding {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.75rem calc(1.25rem + env(safe-area-inset-bottom));
    margin-top: auto;          /* dosuwa stopkę do dołu przy krótkiej treści */
}
.funding-img {
    display: block;
    width: 100%;
    max-width: 860px;
    height: auto;
    margin: 0 auto;
}

/* Na stronie logowania stopka stoi pod kartą, a karta zostaje wyśrodkowana
   w pozostałej przestrzeni - stąd dwa wiersze siatki zamiast place-items. */
.auth-wrap {
    grid-template-rows: 1fr auto;
    align-items: center;
}
.auth-wrap .funding {
    width: 100%;
    background: none;
    border-top: none;
    padding: 1.5rem 0 0;
}
.auth-wrap .funding-img { max-width: 620px; }

@media (max-width: 720px) {
    .funding { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
}

/* =====================================================================
   RUCH I MIKROINTERAKCJE
   ---------------------------------------------------------------------
   Zasady, wg których dobrany jest tu każdy efekt:

     • ruch ma coś ZNACZYĆ - pokazywać, skąd element się wziął, że coś się
       zmieniło albo że system przyjął kliknięcie. Ozdobników nie ma,
     • czas trwania z tokenów (--dur-*), krzywe z tokenów (--ease-*),
       żeby całość wyglądała jak jeden system,
     • nic nie animuje układu (width/height/top) poza paskami postępu -
       tylko transform i opacity, bo tylko one idą po stronie karty graficznej
       i nie powodują przeliczania układu strony,
     • wejścia trwają najwyżej 420 ms i nie opóźniają interakcji: treść jest
       klikalna od pierwszej klatki,
     • ostatnia sekcja wyłącza wszystko dla osób z ustawieniem „ogranicz ruch".
   ===================================================================== */

/* ---------- Klatki kluczowe ---------- */

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse { 50% { opacity: .55; } }

/* Wejście treści: lekko z dołu, z rozjaśnieniem. */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* Wejście bez przesunięcia - dla elementów, które nie mogą „skakać”. */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Komunikat flash. */
@keyframes alert-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: none; }
}
/* Wyjście komunikatu: samo zniknięcie z lekkim uniesieniem. Element usuwa
   z drzewa app.js po zakończeniu, więc nie animujemy wysokości - z „auto”
   i tak nie da się jej płynnie interpolować, a próba daje szarpnięcie. */
@keyframes alert-out {
    to { opacity: 0; transform: translateY(-8px); }
}

/* Znacznik aktywnej pozycji menu. */
@keyframes nav-marker {
    from { transform: translateY(-50%) scaleY(0); }
    to   { transform: translateY(-50%) scaleY(1); }
}
@keyframes bottom-marker {
    from { transform: translateX(-50%) scaleX(0); }
    to   { transform: translateX(-50%) scaleX(1); }
}

/* Pasek nad kafelkiem liczbowym rozjeżdża się w prawo. */
@keyframes stat-bar {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Przebłysk po ukończeniu - jednorazowy, bez zapętlenia. */
@keyframes shine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* Ikona pustego stanu unosi się leniwie - sygnał „tu nic nie ma, ale wszystko działa”. */
@keyframes float-soft {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

/* Zdobyta odznaka / zaliczony test - krótkie „przestrzelenie” skali. */
@keyframes pop {
    0%   { transform: scale(.7); opacity: 0; }
    60%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Poświata dzwonka z nieprzeczytanymi powiadomieniami. */
@keyframes bell-ring {
    0%, 70%, 100% { transform: rotate(0); }
    75% { transform: rotate(11deg); }
    80% { transform: rotate(-9deg); }
    85% { transform: rotate(6deg); }
    90% { transform: rotate(-4deg); }
}

/* Wjazd menu bocznego na telefonie. */
@keyframes backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- System wejść ---------- */

/* Treść strony pojawia się jako całość - jeden spokojny ruch zamiast
   migotania kilkunastu elementów naraz. */
.content > * { animation: rise var(--dur-slow) var(--ease-out) both; }

/* Elementy list i siatek wjeżdżają pojedynczo, gdy wejdą w pole widzenia.
   Atrybut data-reveal dokłada app.js - bez JavaScriptu nic nie zostaje
   ukryte, bo reguła z opacity: 0 nie ma się wtedy do czego przypiąć.
   Kaskada opóźnień daje wrażenie, że lista układa się sama. */
[data-reveal] { opacity: 0; }
[data-reveal].is-revealed { animation: rise var(--dur-slow) var(--ease-out) both; }
[data-reveal].is-revealed:nth-child(2)  { animation-delay: 40ms; }
[data-reveal].is-revealed:nth-child(3)  { animation-delay: 80ms; }
[data-reveal].is-revealed:nth-child(4)  { animation-delay: 120ms; }
[data-reveal].is-revealed:nth-child(5)  { animation-delay: 160ms; }
[data-reveal].is-revealed:nth-child(6)  { animation-delay: 200ms; }
[data-reveal].is-revealed:nth-child(n+7) { animation-delay: 240ms; }

/* ---------- Mikrointerakcje pojedynczych elementów ---------- */

.notif-bell.has-unread svg { animation: bell-ring 5s var(--ease-in-out) 1.5s infinite; }
.notif-badge { animation: pop var(--dur) var(--ease-spring); }

.sidebar-backdrop.show { animation: backdrop-in var(--dur) var(--ease-out); }

.avatar { transition: background var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
a.avatar:hover { transform: scale(1.06); }

.notif-item { transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.notif-item:hover { transform: translateX(3px); box-shadow: var(--shadow-1); }

.lesson-row { transition: background var(--dur-fast) var(--ease-out); }
.lesson-row:hover { background: var(--surface-alt); }
.lesson-check { transition: background var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.lesson-row.is-done .lesson-check { animation: pop var(--dur) var(--ease-spring); }

.option { transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.option:active { transform: scale(.99); }

.icon-btn { transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.icon-btn:active { transform: scale(.92); }

.settings-tab { transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }

.pill { transition: background var(--dur) var(--ease-out); }

.module-card { transition: box-shadow var(--dur) var(--ease-out); }
.module-card:hover { box-shadow: var(--shadow-2); }

.cert-card { transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
.cert-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.cert-ribbon { transition: transform var(--dur) var(--ease-spring); }
.cert-card:hover .cert-ribbon { transform: scale(1.15) rotate(8deg); }

/* Wynik testu - odznaka i punktacja wchodzą z odbiciem, bo to moment,
   na który kursant czeka. */
.result-badge { animation: pop var(--dur-slow) var(--ease-spring); }
.result-score { animation: rise var(--dur-slow) var(--ease-out) 80ms both; }

.chart-bar-fill { transition: width var(--dur-slow) var(--ease-out); }

.wysiwyg { transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.wysiwyg:focus-within { border-color: var(--brand); box-shadow: var(--ring); }

/* =====================================================================
   Ograniczony ruch - ustawienie systemowe „redukuj animacje".
   Zostaje tylko to, co przekazuje informację (kolory, stany), znika
   wszystko, co się porusza. Treść pozostaje w pełni widoczna.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal], [data-reveal].is-revealed { opacity: 1 !important; animation: none !important; }
    .content > * { animation: none !important; }
    .empty-state .icon, .notif-bell.has-unread svg { animation: none !important; }
    .sidebar a.nav-item:hover { padding-left: .8rem; }
    .badge-tile:hover, .stat:hover, .cert-card:hover, .path-step:hover,
    .notif-item:hover, .course-card:hover, .shortcut:hover { transform: none !important; }
}

/* ---------- Wydruk (np. lista wyników) ---------- */
@media print {
    .sidebar, .topbar, .bottom-nav, .toolbar-actions, .row-actions { display: none !important; }
    .main { margin-left: 0; padding: 0; }
    .content { padding: 0; max-width: none; }
    .panel, .card, .table-wrap { box-shadow: none; border-color: #ccc; }
    body { background: #fff; font-size: 12px; }
    /* Oznaczenie dofinansowania zostaje także na papierze. */
    .funding { border-top: 1px solid #ccc; padding: .5rem 0 0; margin-top: 1rem; }
    .funding-img { max-width: 100%; }
    /* Wydruk nie może zgubić treści czekającej na animację wejścia. */
    *, *::before, *::after { animation: none !important; transition: none !important; }
    [data-reveal] { opacity: 1 !important; }
    .content > * { animation: none !important; opacity: 1 !important; }
}
