/* ==========================================================================
   AI School — login.css · wersja 2.0 (nowy wygląd, październik 2026)
   Jeden plik stylów dla wszystkich ekranów. Motyw: html[data-theme="light"|"dark"].
   Bez zasobów zewnętrznych: ikony = wbudowane SVG (sprite w shell()), strzałki/ikony
   komunikatów = data-URI w tym pliku.
   Progi: 1080 px (kompakt) i 760 px (telefon) — zamiast 879/900/760.
   ========================================================================== */

/* Czcionka Plus Jakarta Sans (licencja OFL, public/fonts/OFL.txt). Pliki z paczki
   @fontsource-variable/plus-jakarta-sans 5.3.0: alfabet łaciński + rozszerzony (polskie znaki),
   zakresy znaków jak w paczce. Serwuje je src/login-server.mjs (/fonts/*.woff2). */
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-ext-wght-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-latin-wght-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- 1. Tokeny: jasny motyw ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --accent: #4062e0;
  --accent-dark: #3350c4;
  --accent-ink: #3552cf;
  --accent-soft: #eef1fd;
  --accent-soft-2: #dfe5fb;
  --accent-line: #b9c5f4;
  --on-accent: #ffffff;
  --coral: #f07f8c;
  --cyan: #1aa9b8;
  --brand-gradient: linear-gradient(135deg, #4062e0 0%, #7d8ff0 55%, #f07f8c 100%);

  --canvas: #eef1f6;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf0f6;
  --field: #ffffff;
  --line: #e4e8ef;
  --line-strong: #cfd6e2;
  --ink: #172033;
  --ink-2: #3b465c;
  --muted: #667085;
  --faint: #98a2b3;
  --navy: #1b2550;
  --focus-ring: rgba(64, 98, 224, 0.22);
  --scrim: rgba(16, 22, 42, 0.45);

  --success: #1f9d55; --success-soft: #e7f6ed; --success-line: #b5e3c7; --success-ink: #166c3b;
  --warning: #e08a00; --warning-soft: #fff3df; --warning-line: #f6d39c; --warning-ink: #8f5306;
  --danger: #dc3545;  --danger-soft: #fdecee;  --danger-line: #f5c0c6;  --danger-ink: #a61e2b;
  --violet: #6b4fe0;  --violet-soft: #efebfd;  --violet-line: #cfc4f7;  --violet-ink: #4d33bd;

  --planned: #5b56e8; --planned-bg: #ecebfd; --planned-ink: #3b36b0; --planned-line: #c9c6f7;

  --t-blue: #2f6fe4;   --t-blue-bg: #e7effd;
  --t-violet: #7c4ddb; --t-violet-bg: #f1eafd;
  --t-green: #22994f;  --t-green-bg: #e6f6ea;
  --t-amber: #d98200;  --t-amber-bg: #fff3df;
  --t-pink: #e0507a;   --t-pink-bg: #fdebf1;
  --t-cyan: #13929f;   --t-cyan-bg: #e0f5f7;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px -6px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 16px 36px -14px rgba(23, 32, 51, 0.22);
  --shadow-lg: 0 28px 64px -18px rgba(16, 24, 40, 0.38);
  --shadow-accent: 0 8px 18px -8px rgba(64, 98, 224, 0.62);

  --gap: 20px;
  --pad: 24px;
  --content-max: 1120px;
  --sidebar-w: 252px;
  --hour: 64px; /* = HOUR_HEIGHT w src/calendar-page.mjs — zmień tam 48 → 64 (3 linie w każdym wpisie) */

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ---------- 2. Tokeny: ciemny motyw (ten sam akcent, jaśniejszy stopień) ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --accent: #4a64e8;
  --accent-dark: #5d76f2;
  --accent-ink: #a3b2ff;
  --accent-soft: rgba(110, 134, 255, 0.12);
  --accent-soft-2: rgba(110, 134, 255, 0.22);
  --accent-line: rgba(110, 134, 255, 0.45);
  --coral: #ff8e9a;
  --cyan: #2fd0de;
  --brand-gradient: linear-gradient(135deg, #4a64e8 0%, #8a9bff 55%, #ff8e9a 100%);

  --canvas: #0a0f1e;
  --sidebar: #0f1528;
  --surface: #141b2f;
  --surface-2: #192139;
  --surface-3: #212b46;
  --field: #10172b;
  --line: #232c47;
  --line-strong: #34405f;
  --ink: #f1f4fc;
  --ink-2: #c9d1e6;
  --muted: #9ba5c3;
  --faint: #6d7896;
  --navy: #0b1022;
  --focus-ring: rgba(122, 144, 255, 0.34);
  --scrim: rgba(3, 6, 16, 0.68);

  --success: #34c27a; --success-soft: rgba(52, 194, 122, 0.13); --success-line: rgba(52, 194, 122, 0.36); --success-ink: #84e5b2;
  --warning: #f4a531; --warning-soft: rgba(244, 165, 49, 0.13); --warning-line: rgba(244, 165, 49, 0.38); --warning-ink: #ffcb80;
  --danger: #f2555f;  --danger-soft: rgba(242, 85, 95, 0.14);  --danger-line: rgba(242, 85, 95, 0.42);  --danger-ink: #ff9ca3;
  --violet: #9b84ff;  --violet-soft: rgba(155, 132, 255, 0.15); --violet-line: rgba(155, 132, 255, 0.42); --violet-ink: #c9bdff;

  --planned: #8f8bff; --planned-bg: rgba(143, 139, 255, 0.16); --planned-ink: #cac8ff; --planned-line: rgba(143, 139, 255, 0.42);

  --t-blue: #7ea8ff;   --t-blue-bg: rgba(126, 168, 255, 0.14);
  --t-violet: #b593ff; --t-violet-bg: rgba(181, 147, 255, 0.14);
  --t-green: #5fd394;  --t-green-bg: rgba(95, 211, 148, 0.13);
  --t-amber: #ffbe5c;  --t-amber-bg: rgba(255, 190, 92, 0.13);
  --t-pink: #ff8fb0;   --t-pink-bg: rgba(255, 143, 176, 0.13);
  --t-cyan: #5ad8e4;   --t-cyan-bg: rgba(90, 216, 228, 0.13);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 18px 40px -16px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  --shadow-accent: 0 10px 22px -10px rgba(74, 100, 232, 0.8);

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ba5c3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Statusy zajęć — wspólne aliasy */
:root, [data-theme] {
  --held: var(--success);    --held-bg: var(--success-soft);   --held-ink: var(--success-ink);   --held-line: var(--success-line);
  --notheld: var(--warning); --notheld-bg: var(--warning-soft); --notheld-ink: var(--warning-ink); --notheld-line: var(--warning-line);
  --cancelled: var(--danger); --cancelled-bg: var(--danger-soft); --cancelled-ink: var(--danger-ink); --cancelled-line: var(--danger-line);
}

/* ---------- 3. Podstawy ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[data-theme] { color: var(--ink); font-family: var(--font); }
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft-2); color: var(--ink); }
[hidden] { display: none !important; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.date, .time, [data-num] { font-variant-numeric: tabular-nums; }

/* ---------- 4. Rama zalogowanego użytkownika ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--sidebar);
}
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-scrim { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 16px 20px;
  background: var(--sidebar);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px; overflow: hidden;
  font-size: 0; color: transparent;
  background: #071a3c url("/assets/logo/aischool-ikona.svg") center / cover no-repeat;
  box-shadow: 0 8px 18px -8px rgba(7, 26, 60, .55);
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }

.nav-label { padding: 0 14px; margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.main-nav a {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 14px;
  border-radius: var(--r-md);
  color: var(--muted); font-size: 14.5px; font-weight: 600;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.main-nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.main-nav a.is-active,
.main-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.main-nav a:active { transform: scale(.98); }
.nav-tag { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); }
.main-nav a.is-active .nav-tag { background: rgba(255,255,255,.2); color: #fff; }

.sponsor-badge {
  margin-top: auto;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 16px 14px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: center;
}
/* Logo partnera: plik /assets/spacex-xai-partner.png (czarne na przezroczystym, z podpisem) — dopisz jego serwowanie w src/login-server.mjs */
.sponsor-logo { width: 100%; height: auto; }
[data-theme="dark"] .sponsor-logo { filter: invert(1); }

.workspace {
  min-width: 0;
  display: flex; flex-direction: column;
  background: var(--canvas);
  border-radius: 28px 0 0 28px;
}
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 32px 0; }
.topbar-date { margin-right: auto; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.topbar > .topbar-menu, .topbar > .topbar-brand { display: none; }
.icon-button, .theme-toggle, .logout-button {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.icon-button:hover, .theme-toggle:hover, .logout-button:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.icon-button:active, .theme-toggle:active, .logout-button:active { transform: scale(.94); }
.theme-toggle .ico { transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.theme-toggle:hover .ico { transform: rotate(-24deg); }
.logout-button:hover { color: var(--danger-ink); }
.logout-form { margin: 0; display: contents; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 3px 14px 3px 3px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft-2), #fde1e5);
  color: var(--accent-ink); font-size: 14px; font-weight: 800;
}
[data-theme="dark"] .avatar { background: linear-gradient(135deg, rgba(110,134,255,.32), rgba(255,142,154,.28)); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.user-role { font-size: 12px; color: var(--muted); }

.workspace-main {
  display: flex; flex-direction: column;
  gap: var(--gap);
  padding: 24px 32px 48px;
  min-width: 0;
}

/* ---------- 5. Nagłówek strony (jednakowy na każdym ekranie) ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
.page-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.page-head h1, .page-title { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.lead { color: var(--muted); max-width: 68ch; font-size: 15px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.page-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 28px 32px;
  border-radius: var(--r-lg);
  background: linear-gradient(105deg, var(--surface) 0%, var(--surface) 46%, var(--accent-soft) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.page-hero::before, .page-hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(42px); opacity: .55; }
.page-hero::before { width: 260px; height: 260px; right: 8%; top: -120px; background: var(--accent-soft-2); }
.page-hero::after { width: 200px; height: 200px; right: -40px; bottom: -110px; background: color-mix(in srgb, var(--coral) 32%, transparent); }
.page-hero h1 { font-size: 30px; }
.hero-art { flex: none; width: 260px; height: 132px; }

/* ---------- 6. Okno .panel i nagłówek sekcji ---------- */
.panel {
  min-width: 0;
  padding: var(--pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 20px; }
.panel-head h2, .panel-title { font-size: 18px; font-weight: 700; }
.panel-sub { font-size: 13.5px; color: var(--muted); }

.section-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px; row-gap: 6px;
  margin-bottom: 20px;
}
.section-number {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 13px; font-weight: 800;
}
.section-heading h2 { font-size: 18px; font-weight: 700; }
.section-heading p { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.section-heading.no-number { grid-template-columns: minmax(0, 1fr); }

/* ---------- 7. Przyciski (jeden system: primary / secondary / ghost / sm / icon) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  font-size: 14.5px; font-weight: 700; line-height: 1;
  white-space: nowrap; text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--faint); }
.btn-ghost { color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost.is-danger { color: var(--danger-ink); }
.btn-ghost.is-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 34px; padding: 0 12px; gap: 6px; border-radius: var(--r-sm); font-size: 13px; }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-lg { height: 52px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; margin-left: -1px; }
.btn.is-loading .ico { animation: ais-spin .9s linear infinite; }

/* Przełącznik segmentowy (Tydzień/Miesiąc, typ szkoły w katalogu) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); }
.seg-opt {
  height: 34px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.seg-opt:hover { color: var(--ink); }
.seg-opt.is-active, .seg-opt[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
[data-theme="dark"] .seg-opt.is-active { background: var(--surface-2); }

/* ---------- 8. Plakietki i kapsułki statusów ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--ink-2);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-violet { background: var(--violet-soft); color: var(--violet-ink); }
.badge-live::before { animation: ais-pulse 1.4s ease-out infinite; }

.status-planned, .agenda-status.is-planned { background: var(--planned-bg); color: var(--planned-ink); }
.status-held, .agenda-status.is-held { background: var(--held-bg); color: var(--held-ink); }
.status-not_held, .agenda-status.is-not_held { background: var(--notheld-bg); color: var(--notheld-ink); }
.status-cancelled, .agenda-status.is-cancelled { background: var(--cancelled-bg); color: var(--cancelled-ink); }

/* ---------- 9. Komunikaty ---------- */
.form-error, .form-success, .form-info {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 14px; line-height: 1.45;
  animation: ais-rise .28s ease both;
}
.form-error::before, .form-success::before, .form-info::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px;
  background: currentColor;
  -webkit-mask: var(--msg-icon) center / contain no-repeat; mask: var(--msg-icon) center / contain no-repeat;
}
.form-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink);
  --msg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7.5v5M12 16.5h.01'/%3E%3C/svg%3E"); }
.form-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success-ink);
  --msg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='m8 12.5 2.8 2.8L16.5 9.5'/%3E%3C/svg%3E"); }
.form-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink);
  --msg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v5.5M12 7.5h.01'/%3E%3C/svg%3E"); }
.form-error .btn, .form-error a { margin-left: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--surface);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: ais-toast .3s cubic-bezier(.2,.8,.2,1) both;
}

/* ---------- 10. Pola formularzy (input = select = textarea) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label, .choice-group > legend {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.field > label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.optional { font-weight: 500; color: var(--faint); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.input,
input[type="text"], input[type="password"], input[type="search"], input[type="email"],
input[type="date"], input[type="time"], input[type="number"],
select, textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--field);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.4;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
  -webkit-appearance: none; appearance: none;
}
select { padding-right: 40px; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; text-overflow: ellipsis; cursor: pointer; }
textarea { height: auto; min-height: 92px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator, [data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }

.search-field { position: relative; }
.search-field .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-field input { padding-left: 42px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.choice-group { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.choice-group > legend { padding: 0; margin-bottom: 8px; }

/* Kafelki wyboru (radio / checkbox) */
.choice { position: relative; display: block; min-width: 0; cursor: pointer; }
.choice > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.choice-body {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  height: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.choice-body::after {
  content: ""; position: absolute; top: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface) center / 12px no-repeat;
  transition: background-color .16s ease, border-color .16s ease;
}
.choice > input[type="checkbox"] + .choice-body::after { border-radius: 6px; }
.choice:hover .choice-body { border-color: var(--accent-line); background: var(--surface-2); }
.choice > input:checked + .choice-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice > input:checked + .choice-body::after {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  animation: ais-check .26s cubic-bezier(.2,.9,.3,1.4) both;
}
.choice > input:focus-visible + .choice-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice > input:disabled + .choice-body { opacity: .5; }
.choice-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.choice-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.choice-body.has-icon { flex-direction: row; align-items: center; gap: 12px; }
.choice-body.has-icon .choice-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* Czas lekcji: 5 kafelków w jednym rzędzie, pole „Własna wartość” tylko po wyborze „Własny” */
.segmented-control { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.segmented-control .choice-body { padding: 12px 34px 12px 14px; }
.segmented-control .choice-body::after { top: 10px; right: 10px; width: 16px; height: 16px; }
.segmented-control .choice-title { font-size: 16px; font-weight: 800; }
.segmented-control.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.custom-duration { display: none; max-width: 220px; margin-top: 4px; animation: ais-rise .24s ease both; }
.choice-group:has(input[name="durationMinutes"][value="custom"]:checked) .custom-duration,
.custom-duration.is-visible { display: flex; }

.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; }
.segmented-control.cols-1, .generator-aside .segmented-control { grid-template-columns: minmax(0, 1fr); }
.generator-aside .segmented-control .choice-title { font-size: 14.5px; font-weight: 700; }
.generator-aside .choice-group { margin-top: 2px; }
.generator-aside #generate-button { margin-top: 20px; }
.extras-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Ikona w kafelku (wspólna dla kafelków „Zakres materiału” i kart lekcji) */
.tile-icon, .lesson-card-icon {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--t-blue-bg); color: var(--t-blue);
}
.tile-icon .ico, .lesson-card-icon .ico { width: 20px; height: 20px; }
[data-tone="blue"]   { --tone: var(--t-blue);   --tone-bg: var(--t-blue-bg); }
[data-tone="violet"] { --tone: var(--t-violet); --tone-bg: var(--t-violet-bg); }
[data-tone="green"]  { --tone: var(--t-green);  --tone-bg: var(--t-green-bg); }
[data-tone="amber"]  { --tone: var(--t-amber);  --tone-bg: var(--t-amber-bg); }
[data-tone="pink"]   { --tone: var(--t-pink);   --tone-bg: var(--t-pink-bg); }
[data-tone="cyan"]   { --tone: var(--t-cyan);   --tone-bg: var(--t-cyan-bg); }
[data-tone] .tile-icon, [data-tone] .lesson-card-icon, .tile-icon[data-tone], .lesson-card-icon[data-tone] { background: var(--tone-bg); color: var(--tone); }

/* ---------- 11. Logowanie ---------- */
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  min-height: 100vh;
  padding: 16px;
  gap: 16px;
  background: var(--canvas);
}
.login-story {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px 52px;
  border-radius: 28px;
  background: linear-gradient(150deg, #1f2a5c 0%, #2f47b5 55%, #6b7fe8 100%);
  color: #fff;
}
[data-theme="dark"] .login-story { background: linear-gradient(150deg, #0f1533 0%, #23338a 58%, #4a5fd1 100%); }
.login-story::before, .login-story::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); }
.login-story::before { width: 420px; height: 420px; right: -120px; top: -140px; background: rgba(240, 127, 140, .55); }
.login-story::after { width: 360px; height: 360px; left: -140px; bottom: -160px; background: rgba(47, 208, 222, .4); }
.login-rings { position: absolute; z-index: -1; right: -90px; bottom: -90px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 120px rgba(255,255,255,.025); pointer-events: none; }
.login-story .brand { color: #fff; padding: 0; }
.login-story .brand-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.3), 0 12px 26px -12px rgba(0,0,0,.55); }
.login-copy { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.login-kicker { font-size: 12.5px; font-weight: 700; letter-spacing: 0.16em; color: rgba(255,255,255,.72); }
.login-story h1 { color: #fff; font-size: clamp(40px, 4.4vw, 62px); line-height: 1.04; font-weight: 800; letter-spacing: -0.035em; }
.login-lead { font-size: 17px; line-height: 1.55; color: rgba(255,255,255,.84); max-width: 42ch; }
.login-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 520px; }
.login-steps li {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 14.5px; color: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
}
.step-num { flex: none; height: 26px; padding: 0 10px; display: grid; place-items: center; border-radius: var(--r-pill); background: rgba(255,255,255,.18); font-size: 12px; font-weight: 800; letter-spacing: .04em; }

.login-panel { display: grid; place-items: center; padding: 32px 16px; position: relative; }
.login-panel .theme-toggle { position: absolute; top: 8px; right: 8px; }
.auth-card {
  width: 100%; max-width: 430px;
  display: flex; flex-direction: column; gap: 18px;
  padding: 36px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  animation: ais-rise .5s cubic-bezier(.2,.7,.2,1) both;
}
.auth-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.auth-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-head p { color: var(--muted); }
.password-field { position: relative; }
.password-field input { padding-right: 46px; }
.password-field .reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--faint); }
.password-field .reveal:hover { color: var(--ink); background: var(--surface-3); }
.auth-foot { font-size: 12.5px; color: var(--faint); text-align: center; }

/* ---------- 12. Generator ---------- */
.generator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: var(--gap);
  max-width: var(--content-max);
  width: 100%;
}
.generator-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.generator-aside { position: sticky; top: 20px; display: flex; flex-direction: column; gap: var(--gap); }
.form-section + .form-section { margin-top: 20px; }
.summary-list { margin: 0 0 20px; display: grid; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-row:first-child { padding-top: 0; }
.summary-row dt { font-size: 13px; color: var(--muted); }
.summary-row dd { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink); text-align: right; transition: color .2s ease; }
.summary-row dd.is-updated { animation: ais-flash .6s ease; }
.generator-ready { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
#generate-button .ico { width: 18px; height: 18px; }

/* Okno „Wynik zlecenia” — ta sama szerokość co formularz */
#lesson-panel { max-width: var(--content-max); width: 100%; scroll-margin-top: 16px; animation: ais-rise .4s cubic-bezier(.2,.7,.2,1) both; }
.result-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 16px;
  padding-bottom: 18px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.result-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }
.result-heading h2 { font-size: 18px; font-weight: 700; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#lesson-timer { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
#lesson-timer .ico { width: 16px; height: 16px; }
#lesson-state { }
#lesson-panel[data-status="queued"] #lesson-state,
#lesson-panel[data-status="running"] #lesson-state,
#lesson-panel[data-status="checking"] #lesson-state,
#lesson-panel[data-status="validating"] #lesson-state,
#lesson-panel[data-status="saving"] #lesson-state { background: var(--accent-soft); color: var(--accent-ink); }
#lesson-panel[data-status="done"] #lesson-state,
#lesson-panel[data-status="completed"] #lesson-state { background: var(--success-soft); color: var(--success-ink); }
#lesson-panel[data-status="failed"] #lesson-state { background: var(--danger-soft); color: var(--danger-ink); }
#lesson-panel[data-status="expired"] #lesson-state { background: var(--warning-soft); color: var(--warning-ink); }

#audience-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 700;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
#audience-toggle:hover { border-color: var(--accent-line); background: var(--surface-2); }
#lesson-panel[data-audience="student"] #audience-toggle { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.audience-note { display: none; }
#lesson-panel[data-audience="student"] .audience-note { display: flex; }

.run-progress { display: flex; flex-direction: column; gap: 16px; }
.run-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.run-step { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.run-step::before { content: ""; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); }
.run-step.is-done { color: var(--ink-2); }
.run-step.is-done::before { background: var(--accent); }
.run-step.is-current { color: var(--accent-ink); }
.run-step.is-current::before {
  background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--accent-line) 8px 16px);
  background-size: 22.6px 100%;
  animation: ais-stripes .8s linear infinite;
}
.run-note { font-size: 13.5px; color: var(--muted); }
.skeleton-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.skeleton-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 10px; }
.skeleton-card.is-full { grid-column: 1 / -1; }
.skeleton {
  height: 12px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 45%, var(--surface-3) 90%);
  background-size: 220% 100%;
  animation: ais-shimmer 1.3s ease-in-out infinite;
}
.skeleton.is-icon { width: 40px; height: 40px; border-radius: var(--r-md); }
.skeleton.w-40 { width: 40%; } .skeleton.w-60 { width: 60%; } .skeleton.w-80 { width: 80%; } .skeleton.w-90 { width: 90%; }

#lesson-calls {
  margin-bottom: 16px; padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  overflow-x: auto; white-space: nowrap;
}

/* Treść lekcji */
.lesson-result-title { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.025em; }
.lesson-result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.meta-chip .ico { width: 14px; height: 14px; color: var(--muted); }
.lesson-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.lesson-card {
  min-width: 0;
  padding: 20px 22px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  animation: ais-rise .45s cubic-bezier(.2,.7,.2,1) both;
}
.lesson-card.is-full { grid-column: 1 / -1; }
.lesson-card.is-error { border-color: var(--danger-line); background: var(--danger-soft); }
.lesson-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lesson-card-head h3 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.lesson-card-head .badge { flex: none; }
.lesson-grid > .lesson-card:nth-child(2) { animation-delay: .04s; }
.lesson-grid > .lesson-card:nth-child(3) { animation-delay: .08s; }
.lesson-grid > .lesson-card:nth-child(4) { animation-delay: .12s; }
.lesson-grid > .lesson-card:nth-child(n+5) { animation-delay: .16s; }

.lesson-prose { font-size: 15px; line-height: 1.68; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.lesson-prose > * + * { margin-top: 10px; }
.lesson-prose h3 { font-size: 16px; font-weight: 700; color: var(--ink); margin-top: 20px; }
.lesson-prose h4 { font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 16px; }
.lesson-prose h3:first-child, .lesson-prose h4:first-child { margin-top: 0; }
.lesson-prose ul, .lesson-prose ol { margin-bottom: 0; padding-left: 22px; }
.lesson-prose li + li { margin-top: 4px; }
.lesson-prose li > ul, .lesson-prose li > ol { margin-top: 4px; }
.lesson-prose li::marker { color: var(--accent); font-weight: 700; }
.lesson-prose strong { color: var(--ink); font-weight: 700; }
.lesson-prose blockquote { margin: 12px 0 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent-line); color: var(--ink-2); font-style: italic; }
.lesson-prose code { font-family: var(--font-mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--ink); }
.lesson-prose pre { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; }
.lesson-prose pre code { padding: 0; background: none; }
.lesson-prose table {
  display: block; max-width: 100%; overflow-x: auto;
  margin-top: 14px;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 14px;
}
.lesson-prose th, .lesson-prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 120px; }
.lesson-prose th { background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 13px; }
.lesson-prose tr:last-child td { border-bottom: 0; }
.lesson-prose .math { font-family: var(--font-mono); font-size: .95em; white-space: nowrap; }

/* Quiz */
.quiz-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.quiz-question { padding: 16px 18px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.quiz-question + .quiz-question { margin-top: 12px; }
.quiz-q-head { display: flex; align-items: flex-start; gap: 12px; }
.quiz-num { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 800; color: var(--ink); }
.quiz-q-text { flex: 1; min-width: 0; font-weight: 600; color: var(--ink); line-height: 1.5; }
.quiz-q-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.quiz-points { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.quiz-options, .lesson-prose .quiz-options { list-style: none; margin: 12px 0 0 40px; padding: 0; display: grid; gap: 6px; }
.lesson-prose .quiz-options li + li { margin-top: 0; }
.lesson-prose .quiz-q-text { margin: 0; }
#lesson-sections > .audience-note { margin-bottom: 16px; }
.quiz-options li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.opt-letter { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 700; color: var(--muted); }
.quiz-options li.is-correct { border-color: var(--success-line); background: var(--success-soft); color: var(--success-ink); font-weight: 700; }
.quiz-options li.is-correct .opt-letter { background: var(--success); border-color: var(--success); color: #fff; }
.answer-key { margin: 12px 0 0 40px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--success-soft); border: 1px solid var(--success-line); color: var(--success-ink); font-size: 14px; line-height: 1.55; }
.answer-key > * + * { margin-top: 6px; }
.answer-key-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.answer-key-options { margin: 4px 0 0; padding-left: 18px; }
.quiz-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 13.5px; color: var(--muted); }
.quiz-footer strong { color: var(--ink); }

/* Zadania z rozwiązaniem (tylko nauczyciel) */
.task-key { margin: 12px 0 0; border-radius: var(--r-md); border: 1px solid var(--success-line); background: var(--success-soft); color: var(--success-ink); overflow: hidden; }
.task-key-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 14px; font-size: 14px; }
.task-key-row + .task-key-row { border-top: 1px solid var(--success-line); }
.task-key-row dt { font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; padding-top: 2px; }
.task-key-row dd { margin: 0; color: var(--ink-2); }

/* Podgląd ucznia: znikają klucze i elementy dla nauczyciela */
#lesson-panel[data-audience="student"] .teacher-only,
#lesson-panel[data-audience="student"] .answer-key { display: none !important; }
#lesson-panel[data-audience="student"] .quiz-options li.is-correct { border-color: var(--line); background: var(--surface); color: var(--ink-2); font-weight: 400; }
#lesson-panel[data-audience="student"] .quiz-options li.is-correct .opt-letter { background: transparent; border-color: var(--line-strong); color: var(--muted); }

/* Obrazy i wideo */
.lesson-media { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.lesson-media + .lesson-media { margin-top: 10px; }
.lesson-media-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.lesson-media-title { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.lesson-media-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.lesson-media-links a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.lesson-empty { display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r-md); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 14px; }

/* ---------- 13. Historia ---------- */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 18px; }
.table-frame { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.history-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.history-table th {
  padding: 12px 16px;
  text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.history-table th[data-sort] { cursor: pointer; user-select: none; transition: color .16s ease; }
.history-table th[data-sort]:hover { color: var(--ink); }
.history-table th[data-sort]::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px;
  background: currentColor; opacity: .4;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.history-table th.is-asc, .history-table th.is-desc { color: var(--accent-ink); }
.history-table th.is-asc::after, .history-table th.is-desc::after {
  opacity: 1;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E");
}
.history-table th.is-desc::after { transform: rotate(180deg); }
.history-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.history-table tbody tr { transition: background-color .14s ease; }
.history-table tbody tr:hover td { background: var(--surface-2); }
.history-table tbody tr:last-child td { border-bottom: 0; }
.cell-title { font-weight: 700; color: var(--ink); }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state .tile-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--surface); }

/* ---------- 14. Kalendarz ---------- */
.calendar-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 18px; }
.cal-title { display: flex; flex-direction: column; gap: 2px; }
.cal-range { font-size: 20px; font-weight: 800; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.cal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; }

.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.week-view { display: grid; grid-template-columns: 60px repeat(7, minmax(0, 1fr)); min-width: 760px; }
.hour-head { position: sticky; top: 0; z-index: 2; padding: 10px 6px; text-align: center; background: var(--surface-2); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.hour-head:first-child { border-left: 0; }
.hour-head .day-name { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.hour-head .day-date { display: inline-grid; place-items: center; min-width: 30px; height: 26px; margin-top: 2px; padding: 0 8px; border-radius: var(--r-pill); font-size: 14px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.hour-head.is-today { background: var(--accent-soft); }
.hour-head.is-today .day-name { color: var(--accent-ink); }
.hour-head.is-today .day-date { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.hour-head.is-weekend .day-name { color: var(--faint); }
.hour-col { display: flex; flex-direction: column; }
.hour-mark { height: var(--hour); padding: 0 8px 0 0; text-align: right; font-size: 11.5px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; transform: translateY(-8px); }
.hour-mark:first-child { visibility: hidden; }
.day-col { position: relative; border-left: 1px solid var(--line); }
.day-col.is-today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.day-col.is-weekend { background: var(--surface-2); }
.hour-slot { position: relative; height: var(--hour); border-top: 1px solid var(--line); cursor: pointer; transition: background-color .12s ease; }
.hour-slot:first-child { border-top: 0; }
.hour-slot:hover { background: var(--accent-soft); }
.hour-slot:hover::after { content: "+ Dodaj"; position: absolute; left: 8px; top: 6px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); }
.hour-spacer { height: var(--hour); }
.now-line { position: absolute; left: 0; right: 0; z-index: 3; height: 2px; background: var(--coral); pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 30%, transparent); }

.cal-event {
  position: absolute; z-index: 1;
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--planned-line);
  background: var(--planned-bg); color: var(--planned-ink);
  font-size: 11.5px; line-height: 1.3;
  overflow: hidden; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
  animation: ais-fade .3s ease both;
}
.cal-event:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); z-index: 2; }
.cal-event .ev-title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .ev-time { font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.cal-event .ev-meta, .cal-event .ev-topic { opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .hour-status { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 10.5px; letter-spacing: .03em; text-transform: uppercase; }
.cal-event .hour-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mini-planned { --ev-bg: var(--planned-bg); --ev-ink: var(--planned-ink); --ev-line: var(--planned-line); --ev-dot: var(--planned); }
.mini-held { --ev-bg: var(--held-bg); --ev-ink: var(--held-ink); --ev-line: var(--held-line); --ev-dot: var(--held); }
.mini-not_held { --ev-bg: var(--notheld-bg); --ev-ink: var(--notheld-ink); --ev-line: var(--notheld-line); --ev-dot: var(--notheld); }
.mini-cancelled { --ev-bg: var(--cancelled-bg); --ev-ink: var(--cancelled-ink); --ev-line: var(--cancelled-line); --ev-dot: var(--cancelled); }
.cal-event.mini-planned, .cal-event.mini-held, .cal-event.mini-not_held, .cal-event.mini-cancelled { background: var(--ev-bg); color: var(--ev-ink); border-color: var(--ev-line); }
.mini-cancelled .ev-title, .mini-cancelled .mini-title { text-decoration: line-through; }

.month-view { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.month-weekday { padding: 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.month-day { min-height: 116px; padding: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; transition: background-color .12s ease; min-width: 0; }
.month-day:hover { background: var(--surface-2); }
.month-day.is-outside { background: var(--surface-2); }
.month-day.is-outside .day-num { color: var(--faint); }
.month-day.is-outside .mini-event { opacity: .55; }
.day-num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.month-day.is-today .day-num { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.mini-event { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 2px 6px; border-radius: 6px; background: var(--ev-bg); color: var(--ev-ink); font-size: 11.5px; line-height: 1.5; }
.mini-event::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--ev-dot); }
.mini-time { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.mini-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.more-link { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 0 6px; }

/* Plan zajęć */
.agenda-panel { }
.agenda-list { display: flex; flex-direction: column; }
.agenda-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); animation: ais-fade .3s ease both; }
.agenda-item:first-child { border-top: 0; padding-top: 0; }
.agenda-when { display: flex; flex-direction: column; gap: 2px; }
.agenda-date { font-size: 14.5px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.agenda-day { font-size: 12.5px; color: var(--muted); text-transform: capitalize; }
.agenda-time { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.agenda-time .ico { width: 14px; height: 14px; color: var(--muted); }
.agenda-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.agenda-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.agenda-meta { font-size: 12.5px; color: var(--muted); }
.agenda-title { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.agenda-item.is-cancelled .agenda-title { text-decoration: line-through; color: var(--muted); }
.agenda-note { font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--r-sm); }
.agenda-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -8px; }
.agenda-actions .btn-sm { padding: 0 10px; }
.agenda-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }

/* ---------- 15. Okno „Zaplanuj zajęcia” ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: 24px;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  animation: ais-fade .2s ease both;
}
.modal-backdrop > .panel {
  width: 100%; max-width: 760px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: ais-pop .26s cubic-bezier(.2,.8,.2,1) both;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.modal-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.modal-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.modal-grid .col-6 { grid-column: span 6; } .modal-grid .col-3 { grid-column: span 3; } .modal-grid .col-2 { grid-column: span 2; }
.modal-step { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.modal-step::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.modal-step:first-child { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal-actions a.btn { text-decoration: none; }

/* ---------- 15b. Chmurka zajęć i wybór statusu ---------- */
.event-tip { position: fixed; z-index: 85; width: 300px; padding: 14px 16px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); pointer-events: none; animation: ais-tip .16s ease both; }
.event-tip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.event-tip-hint { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.event-tip-title { margin-top: 8px; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.event-tip-rows { display: grid; gap: 7px; margin-top: 10px; }
.event-tip-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.event-tip-row .ico { width: 16px; height: 16px; margin-top: 1px; color: var(--muted); }
.event-tip-row b { font-weight: 600; color: var(--muted); }
.event-tip-note { margin-top: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
@keyframes ais-tip { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
.cal-event:focus-visible, .mini-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mini-event { cursor: pointer; transition: filter .12s ease; }
.mini-event:hover { filter: brightness(.96); }
.status-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.status-choice[data-status="planned"] { --sd: var(--planned); }
.status-choice[data-status="held"] { --sd: var(--held); }
.status-choice[data-status="not_held"] { --sd: var(--notheld); }
.status-choice[data-status="cancelled"] { --sd: var(--cancelled); }
.status-choice .choice-body { flex-direction: row; align-items: center; gap: 8px; padding: 10px 32px 10px 12px; }
.status-choice .choice-body::after { top: 50%; margin-top: -8px; right: 10px; width: 16px; height: 16px; }
.status-choice .choice-title { font-size: 13.5px; }
.status-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--sd); }
.status-choice > input:checked + .choice-body { border-color: var(--sd); background: color-mix(in srgb, var(--sd) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--sd); }
.status-choice > input:checked + .choice-body::after { border-color: var(--sd); background-color: var(--sd); }
.modal-aside-action { margin-right: auto; }

/* ---------- 13b. Pulpit (analityka i skróty) ---------- */
/* Liczniki: <span class="count" data-to="42" data-suffix="%">42</span> — mały skrypt odlicza od 0 do wartości (bez skryptu widać od razu liczbę) */
.count { display: inline-block; min-width: 1ch; font-variant-numeric: tabular-nums; }

.dash-toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; }
.dash-title { font-size: 20px; font-weight: 800; letter-spacing: -0.015em; }
.dash-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.w-3 { grid-column: span 3; } .w-3 .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .w-4 { grid-column: span 4; } .w-5 { grid-column: span 5; } .w-6 { grid-column: span 6; } .w-7 { grid-column: span 7; } .w-8 { grid-column: span 8; } .w-12 { grid-column: span 12; }
.widget { display: flex; flex-direction: column; min-width: 0; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); animation: ais-rise .5s cubic-bezier(.2,.7,.2,1) both; }
.dash-grid > .widget:nth-child(2) { animation-delay: .05s; } .dash-grid > .widget:nth-child(3) { animation-delay: .1s; } .dash-grid > .widget:nth-child(4) { animation-delay: .14s; } .dash-grid > .widget:nth-child(n+5) { animation-delay: .18s; }
.widget-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 16px; }
.widget-head h2 { font-size: 16px; font-weight: 700; }
.widget-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.widget-link { display: inline-flex; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--accent-ink); cursor: pointer; white-space: nowrap; }
.widget-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.widget-link .ico { width: 16px; height: 16px; }
.widget-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; }
.seg.seg-sm .seg-opt { height: 28px; padding: 0 10px; font-size: 12.5px; }

.kpi-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); }
.kpi {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 18px 18px 16px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
  font: inherit; color: inherit; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation: ais-rise .5s cubic-bezier(.2,.7,.2,1) both;
}
.kpi::before { content: ""; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%; background: var(--tone-bg); opacity: .7; transition: transform .4s ease; pointer-events: none; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--tone); }
.kpi:hover::before { transform: scale(1.25); }
.kpi-row > .kpi:nth-child(2) { animation-delay: .05s; } .kpi-row > .kpi:nth-child(3) { animation-delay: .1s; } .kpi-row > .kpi:nth-child(4) { animation-delay: .15s; } .kpi-row > .kpi:nth-child(5) { animation-delay: .2s; }
.kpi > * { position: relative; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.kpi .tile-icon { width: 46px; height: 46px; }
.kpi .tile-icon .ico { width: 22px; height: 22px; }
.kpi-spark { width: 86px; height: 34px; overflow: visible; }
.kpi-spark-line { fill: none; stroke: var(--tone); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.kpi-spark-area { fill: var(--tone); opacity: .12; stroke: none; }
.kpi-spark { animation: ais-reveal 1.4s .2s cubic-bezier(.4,0,.2,1) both; }
.kpi-value { display: flex; align-items: baseline; gap: 8px; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; color: var(--ink); }
.kpi-value small { font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--tone); }
.kpi-label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--success-soft); color: var(--success-ink); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.delta.is-down { background: var(--danger-soft); color: var(--danger-ink); }
.delta.is-flat { background: var(--surface-3); color: var(--muted); }

.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.widget { container-type: inline-size; }
@container (max-width: 400px) {
  .mini-kpis, .duo-kpis { grid-template-columns: minmax(0, 1fr); }
  .att-item { grid-template-columns: 36px minmax(0, 1fr); }
  .att-item .btn { grid-column: 2; justify-self: start; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 104px minmax(0, 1fr) 36px; }
}
.mini-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); text-align: left; font: inherit; color: inherit; min-width: 0; }
button.mini-kpi { cursor: pointer; transition: border-color .16s ease, transform .16s ease; }
button.mini-kpi:hover { border-color: var(--tone); transform: translateY(-2px); }
.mini-kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.mini-kpi .tile-icon { width: 34px; height: 34px; border-radius: var(--r-sm); }
.mini-kpi .tile-icon .ico { width: 18px; height: 18px; }
.mini-kpi-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.mini-kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.15; }
.mini-kpi-value.is-text { font-size: 20px; }
.mini-kpi-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); line-height: 1.35; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.series-toggle { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 8px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; font-weight: 700; color: var(--faint); cursor: pointer; transition: color .16s ease, border-color .16s ease; }
.series-toggle i { position: relative; width: 28px; height: 16px; border-radius: var(--r-pill); background: var(--surface-3); transition: background-color .2s ease; }
.series-toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.series-toggle.is-on { color: var(--ink-2); }
.series-toggle.is-on i { background: var(--sc); }
.series-toggle.is-on i::after { transform: translateX(12px); }
.chart { position: relative; height: 236px; margin-top: auto; }
.chart.chart-sm { height: 190px; }
.chart-gridline { position: absolute; left: 34px; right: 0; height: 0; border-top: 1px dashed var(--line); }
.chart-gridline span { position: absolute; left: -36px; top: -8px; width: 28px; text-align: right; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chart-plot { position: absolute; left: 34px; right: 6px; top: 0; bottom: 24px; }
.chart-gridline { right: 6px; }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: ais-reveal 1.4s cubic-bezier(.4,0,.2,1) both; }
.chart-line { fill: none; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; animation: ais-fade .4s ease both; }
.chart-area { stroke: none; animation: ais-fade .9s .35s ease both; }
.chart-x { position: absolute; left: 34px; right: 6px; bottom: 0; height: 18px; }
.chart-x span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--faint); white-space: nowrap; }
.chart-x span:first-child { transform: none; }
.chart-x span:last-child { transform: translateX(-100%); }
.chart-hit { position: absolute; top: 0; bottom: 0; z-index: 3; cursor: crosshair; }
.chart-guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--line-strong); pointer-events: none; }
.chart-dot { position: absolute; z-index: 2; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--surface); border: 3px solid var(--sc); box-shadow: var(--shadow-sm); pointer-events: none; animation: ais-check .25s ease both; }
.chart-tip { position: absolute; z-index: 4; transform: translate(-50%, calc(-100% - 16px)); display: flex; flex-direction: column; gap: 3px; padding: 9px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); font-size: 12.5px; white-space: nowrap; pointer-events: none; animation: ais-fade .15s ease both; }
.chart-tip.is-left { transform: translate(-10%, calc(-100% - 16px)); }
.chart-tip.is-right { transform: translate(-90%, calc(-100% - 16px)); }
.chart-tip strong { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.chart-tip-row { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ink); }
.chart-tip-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
@keyframes ais-reveal { from { clip-path: inset(-24px 100% -24px -24px); } to { clip-path: inset(-24px -24px -24px -24px); } }

.donut-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: auto; margin-bottom: auto; }
.donut { position: relative; width: 156px; height: 156px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.donut-seg { fill: none; stroke-width: 5; animation: ais-seg 1.2s cubic-bezier(.2,.7,.2,1) both; transition: stroke-width .2s ease; }
.donut:hover .donut-seg { stroke-width: 5.6; }
@keyframes ais-seg { from { stroke-dasharray: 0 100; } }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.1; }
.donut-label { font-size: 11px; font-weight: 600; color: var(--muted); max-width: 74px; margin: 2px auto 0; line-height: 1.25; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; flex: 1; min-width: 150px; }
.legend-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.legend-list i { width: 10px; height: 10px; flex: none; border-radius: 3px; background: var(--lc); }
.legend-list b { margin-left: auto; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-list small { min-width: 36px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--tone); }
.bar-track { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--tone, var(--accent)); animation: ais-grow 1.1s cubic-bezier(.2,.7,.2,1) both; }
.bar-row:nth-child(2) .bar-fill { animation-delay: .04s; } .bar-row:nth-child(3) .bar-fill { animation-delay: .08s; } .bar-row:nth-child(4) .bar-fill { animation-delay: .12s; } .bar-row:nth-child(n+5) .bar-fill { animation-delay: .16s; }
@keyframes ais-grow { from { width: 0; } }
.bar-value { text-align: right; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

.mini-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.mini-cal-wd { padding: 2px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.mini-cal-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px 0 5px; border: 0; border-radius: var(--r-sm); background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-variant-numeric: tabular-nums; transition: background-color .12s ease; }
.mini-cal-day:hover { background: var(--surface-2); }
.mini-cal-day.is-weekend { color: var(--muted); }
.mini-cal-day.is-outside { color: var(--faint); opacity: .55; }
.mini-cal-num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; transition: background-color .15s ease; }
.mini-cal-day.is-today .mini-cal-num { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.mini-cal-dots { display: flex; justify-content: center; gap: 2px; height: 3px; }
.mini-cal-dots i { width: 8px; height: 3px; border-radius: 2px; background: var(--ev-dot); }

.dcal { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.dcal-head, .dcal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dcal-head { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dcal-head span { padding: 8px 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dcal-head span:nth-child(n+6) { color: var(--faint); }
.dcal-day { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 4px; min-width: 0; min-height: 60px; padding: 6px 6px 7px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); font: inherit; text-align: left; color: inherit; cursor: pointer; transition: background-color .14s ease; }
.dcal-day:nth-child(7n) { border-right: 0; }
.dcal-day:nth-last-child(-n+7) { border-bottom: 0; }
.dcal-day.is-weekend, .dcal-day.is-outside { background: var(--surface-2); }
.dcal-day:hover, .dcal-day:focus-visible { background: var(--accent-soft); outline: none; }
.dcal-day:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dcal-num { width: 24px; height: 24px; margin: -2px 0 0 -2px; display: grid; place-items: center; border-radius: 50%; font-size: 12.5px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; transition: background-color .15s ease; }
.dcal-day.is-outside .dcal-num { color: var(--faint); }
.dcal-day.is-outside .dcal-bars { opacity: .45; }
.dcal-day.is-today { background: var(--accent-soft); }
.dcal-day.is-today .dcal-num { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.dcal-more { align-self: flex-end; margin-top: -2px; font-size: 10px; font-weight: 800; color: var(--muted); }
.dcal-bars { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.dcal-bars i { display: block; height: 4px; border-radius: 2px; background: var(--ev-dot); transform-origin: left; animation: ais-grow-x .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes ais-grow-x { from { transform: scaleX(0); } }
.dcal + .cal-legend { margin-top: 12px; gap: 6px 12px; font-size: 11.5px; }
.day-tip { width: 320px; }
.day-tip-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.day-tip-item { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 7px 9px; border-radius: var(--r-sm); background: var(--ev-bg); color: var(--ev-ink); }
.day-tip-time { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-tip-time::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ev-dot); }
.day-tip-body { display: flex; flex-direction: column; min-width: 0; }
.day-tip-body b { font-size: 12.5px; font-weight: 700; }
.day-tip-body small { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-tip-item.mini-cancelled .day-tip-body { text-decoration: line-through; }
.day-tip-foot { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.upcoming { display: flex; flex-direction: column; gap: 10px; }
.up-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .16s ease, background-color .16s ease, transform .16s ease; }
.up-item:hover { border-color: var(--accent-line); background: var(--surface-2); transform: translateX(2px); }
.up-date { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 54px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); }
.up-date b { font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.up-date small { margin-top: 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.up-item.is-today .up-date { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.up-body { min-width: 0; }
.up-title { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.up-material { margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 24px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .ico { width: 13px; height: 13px; flex: none; }
.chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-ok { background: var(--success-soft); color: var(--success-ink); }
.chip-warn { background: var(--warning-soft); color: var(--warning-ink); }
.chip-accent { height: 30px; padding: 0 4px 0 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; }
.chip-x { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.chip-x:hover { background: var(--accent-soft-2); }
.chip-x .ico { width: 14px; height: 14px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }

.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.att-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); animation: ais-rise .4s cubic-bezier(.2,.7,.2,1) both; }
.att-item:nth-child(2) { animation-delay: .06s; } .att-item:nth-child(3) { animation-delay: .12s; } .att-item:nth-child(n+4) { animation-delay: .18s; }
.att-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.att-desc { font-size: 12.5px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }

.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex: 1; align-content: center; }
.quick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 12px 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: center; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.quick:hover { transform: translateY(-3px); border-color: var(--tone); box-shadow: var(--shadow-sm); }
.quick .tile-icon { width: 46px; height: 46px; transition: transform .25s cubic-bezier(.2,.8,.2,1.4); }
.quick:hover .tile-icon { transform: scale(1.08) rotate(-5deg); }

.duo-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.duo-kpi { display: flex; align-items: center; gap: 12px; min-width: 0; }
.duo-kpi .arrow { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sc); color: #fff; box-shadow: 0 8px 16px -8px var(--sc); }
.duo-kpi small { display: block; font-size: 12px; color: var(--muted); }
.duo-kpi b { display: block; font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.2; }

.recent-table td { padding: 11px 12px; }
.recent-table th { padding: 10px 12px; }
.widget .table-frame { border-radius: var(--r-md); }
.owner-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .w-4 { grid-column: span 6; }
  .w-5, .w-7, .w-8 { grid-column: span 12; }
  .w-3 { grid-column: span 6; }
}
@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi-row > .kpi:first-child { grid-column: 1 / -1; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .kpi-spark { width: 64px; }
  .dash-grid > [class*="w-"] { grid-column: 1 / -1; }
  .dash-controls { width: 100%; }
  .dash-controls .seg { flex: 1; }
  .dash-controls .seg-opt { flex: 1; justify-content: center; }
  .widget { padding: 16px; }
  .chart { height: 200px; }
  .bar-row { grid-template-columns: 108px minmax(0, 1fr) 36px; }
  .owner-stats, .duo-kpis { grid-template-columns: minmax(0, 1fr); }
  .att-item { grid-template-columns: 36px minmax(0, 1fr); }
  .att-item .btn { grid-column: 2; justify-self: start; }
}

/* ---------- 15c. Produkcja: zachowania sterowane atrybutami (bez frameworka) ---------- */
.theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
.history-table tr[data-tag-hidden] { display: none !important; }
.chart-line.is-hidden, .chart-area.is-hidden { display: none; }
a.cal-event, a.mini-event, a.dcal-day { text-decoration: none; }
/* Stepper w „Wyniku zlecenia” sterowany samym data-status na #lesson-panel */
#lesson-panel[data-status="running"] .run-step:nth-child(1),
#lesson-panel[data-status="checking"] .run-step:nth-child(-n+2),
#lesson-panel[data-status="saving"] .run-step:nth-child(-n+3) { color: var(--ink-2); }
#lesson-panel[data-status="running"] .run-step:nth-child(1)::before,
#lesson-panel[data-status="checking"] .run-step:nth-child(-n+2)::before,
#lesson-panel[data-status="saving"] .run-step:nth-child(-n+3)::before { background: var(--accent); animation: none; }
#lesson-panel[data-status="queued"] .run-step:nth-child(1),
#lesson-panel[data-status="running"] .run-step:nth-child(2),
#lesson-panel[data-status="checking"] .run-step:nth-child(3),
#lesson-panel[data-status="saving"] .run-step:nth-child(4) { color: var(--accent-ink); }
#lesson-panel[data-status="queued"] .run-step:nth-child(1)::before,
#lesson-panel[data-status="running"] .run-step:nth-child(2)::before,
#lesson-panel[data-status="checking"] .run-step:nth-child(3)::before,
#lesson-panel[data-status="saving"] .run-step:nth-child(4)::before { background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--accent-line) 8px 16px); background-size: 22.6px 100%; animation: ais-stripes .8s linear infinite; }

/* ---------- 16. Katalog ---------- */
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.catalog-card { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); animation: ais-rise .35s ease both; }
.catalog-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.catalog-card h3 { font-size: 16px; font-weight: 700; }
.catalog-annex { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.subject-list-label { margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.subject-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.subject-list li { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.subject-list .subject-note { display: none; }
.catalog-toolbar .seg { max-width: 100%; overflow-x: auto; }

/* ---------- 16b. Dodatki: karta „Dziś”, mini-lista miesiąca, wyróżnienie w planie ---------- */
.page-hero .page-actions { margin-top: 14px; }
.today-card { flex: none; width: 300px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow-md); backdrop-filter: blur(10px); }
.today-card-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.today-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; }
.today-row .time { font-weight: 800; color: var(--ink); }
.today-row .title { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--ev-dot, var(--planned)); }
.today-row.is-next { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.mini-list { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hour-mark:first-child { visibility: visible; transform: none; }
.cal-event { padding: 3px 7px; gap: 0; font-size: 11px; line-height: 13px; }
.cal-event { container-type: inline-size; }
.cal-event > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 104px) { .cal-event .ev-end { display: none; } }
.cal-event .ev-time { font-size: 10.5px; font-weight: 700; opacity: .9; padding-right: 16px; font-variant-numeric: tabular-nums; }
.cal-event .ev-subject { font-size: 11.5px; font-weight: 700; }
.cal-event .ev-topic { opacity: .86; }
.mini-cancelled .ev-subject, .mini-cancelled .ev-topic { text-decoration: line-through; }
.ev-lesson, .cal-event .ev-lesson { position: absolute; top: 2px; right: 2px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 5px; background: var(--accent); color: #fff; box-shadow: 0 2px 6px -2px rgba(30, 50, 140, .6); }
.ev-lesson .ico { width: 10px; height: 10px; stroke-width: 2.2; }
.ev-lesson.is-inline { position: static; display: inline-grid; }
.mini-lesson { width: 13px; height: 13px; flex: none; display: grid; place-items: center; margin-left: auto; border-radius: 4px; background: var(--accent); color: #fff; }
.mini-lesson .ico { width: 9px; height: 9px; stroke-width: 2.4; }
.chip-lesson { background: var(--accent-soft); color: var(--accent-ink); }
.chip-lesson .ico { stroke-width: 2.2; }
@media (max-width: 760px) { .mini-event .mini-lesson { display: none; } }
.agenda-item.is-focus { margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--r-md); animation: ais-focus 1.6s ease both; }
@keyframes ais-focus { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }

/* ---------- 17. Ruch ---------- */
.workspace-main > * { animation: ais-rise .42s cubic-bezier(.2,.7,.2,1) both; }
.workspace-main > *:nth-child(2) { animation-delay: .05s; }
.workspace-main > *:nth-child(3) { animation-delay: .1s; }
.workspace-main > *:nth-child(n+4) { animation-delay: .14s; }
html.theme-anim, html.theme-anim * { transition: background-color .3s ease, border-color .3s ease, color .3s ease, fill .3s ease !important; }
@keyframes ais-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ais-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ais-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ais-check { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes ais-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes ais-stripes { to { background-position: 22.6px 0; } }
@keyframes ais-pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 80%, 100% { box-shadow: 0 0 0 6px transparent; } }
@keyframes ais-spin { to { transform: rotate(360deg); } }
@keyframes ais-flash { 0% { color: var(--accent-ink); } 100% { color: var(--ink); } }
@keyframes ais-toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes ais-drawer { from { transform: translateX(-100%); } to { transform: none; } }

/* ---------- 18. Próg 1080 px ---------- */
@media (max-width: 1080px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { padding: 32px; gap: 28px; }
  .login-story h1 { font-size: 40px; }
  .generator-layout { grid-template-columns: 1fr; }
  .generator-aside { position: static; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search-field-wrap { grid-column: 1 / -1; }
  .hero-art, .today-card { display: none; }
}

/* ---------- 19. Próg 760 px (telefon) ---------- */
@media (max-width: 760px) {
  :root, [data-theme] { --pad: 16px; --gap: 16px; }
  body { font-size: 15px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 70;
    width: 284px; height: auto;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
  .nav-toggle:checked ~ .nav-scrim { opacity: 1; pointer-events: auto; }
  .workspace { border-radius: 0; }
  .topbar {
    position: sticky; top: 0; z-index: 40;
    justify-content: flex-start; gap: 8px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--canvas) 86%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar > .topbar-menu { display: inline-grid; }
  .topbar > .topbar-brand { display: flex; align-items: center; gap: 8px; margin-right: auto; font-weight: 800; font-size: 16px; color: var(--ink); }
  .topbar-brand .brand-mark { width: 32px; height: 32px; font-size: 12px; border-radius: 10px; box-shadow: none; }
  .topbar-date, .user-meta { display: none; }
  .user-chip { padding: 2px; border-radius: 50%; }
  .avatar { width: 34px; height: 34px; }
  .icon-button, .theme-toggle, .logout-button { width: 40px; height: 40px; box-shadow: none; }
  .workspace-main { padding: 16px 16px 32px; }
  .page-head { align-items: flex-start; }
  .page-head h1, .page-title { font-size: 24px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .page-hero { padding: 20px; }
  .page-hero h1 { font-size: 24px; }
  .panel-head h2, .section-heading h2 { font-size: 17px; }
  .form-grid, .extras-grid, .lesson-grid, .skeleton-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .topic-row { grid-template-columns: minmax(0, 1fr); }
  .segmented-control, .segmented-control.cols-2 { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .segmented-control .choice-body { flex-direction: row; align-items: baseline; gap: 10px; padding: 12px 40px 12px 14px; }
  .segmented-control .choice-body::after { top: 50%; margin-top: -8px; right: 14px; }
  .segmented-control .choice-title { font-size: 15px; min-width: 64px; }
  .custom-duration { max-width: none; }
  .btn-lg { height: 50px; }

  .login-shell { padding: 0; gap: 0; }
  .login-story { border-radius: 0 0 24px 24px; padding: 24px 20px 28px; gap: 18px; }
  .login-story h1 { font-size: 32px; }
  .login-lead { font-size: 15px; }
  .login-steps, .login-rings { display: none; }
  .login-panel { place-items: start center; padding: 20px 16px 32px; }
  .login-panel .theme-toggle { top: -60px; right: 16px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: #fff; }
  .auth-card { padding: 22px; box-shadow: var(--shadow-sm); }
  .auth-head h2 { font-size: 22px; }

  .result-toolbar { align-items: flex-start; }
  .result-actions { width: 100%; }
  .run-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-result-title { font-size: 21px; }
  .lesson-card { padding: 16px; }
  .lesson-prose { font-size: 15px; }
  .quiz-question { padding: 14px; }
  .quiz-options, .answer-key { margin-left: 0; }
  .task-key-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }

  .filters { grid-template-columns: minmax(0, 1fr); }
  .table-frame { border: 0; background: transparent; overflow: visible; }
  .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; width: 100%; }
  .history-table thead { display: none; }
  .history-table tr { margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
  .history-table td { padding: 4px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; }
  .history-table tbody tr:hover td { background: transparent; }
  .history-table td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted); }
  .history-table td.cell-main { display: block; padding-bottom: 8px; }
  .history-table td.cell-actions { display: block; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line); }
  .history-mobile-sort { display: flex; }
  .table-foot { border: 0; padding: 4px 2px; background: transparent; }

  .cal-toolbar { align-items: flex-start; }
  .cal-actions { width: 100%; justify-content: space-between; }
  .cal-scroll { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .week-view { min-width: 680px; }
  .month-day { min-height: 64px; padding: 4px; gap: 3px; }
  .month-weekday { padding: 8px 4px; text-align: center; font-size: 10.5px; }
  .day-num { width: 24px; height: 24px; font-size: 12px; }
  .mini-event { padding: 0; height: 6px; width: 6px; background: transparent; font-size: 0; }
  .mini-event .mini-time, .mini-event .mini-title { display: none; }
  .month-day .mini-list { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 4px; }
  .more-link { font-size: 10px; padding: 0 4px; }
  .agenda-item { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .agenda-when { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .agenda-time { margin-top: 0; }

  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal-backdrop > .panel { max-width: none; max-height: 92vh; border-radius: 22px 22px 0 0; padding: 20px 16px 24px; animation-name: ais-sheet; }
  .modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .modal-grid .col-6, .modal-grid .col-3 { grid-column: span 2; }
  .modal-grid .col-2 { grid-column: span 1; }
  .modal-grid .col-2.is-date { grid-column: span 2; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-aside-action { margin-right: 0; }
  .status-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-tip { display: none; }
  .modal-actions .btn { width: 100%; }
  .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .toast { left: 16px; right: 16px; transform: none; border-radius: var(--r-md); animation-name: ais-fade; }
}
@keyframes ais-sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 20. Mniej ruchu ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 21. Druk: tylko lekcja ---------- */
@media print {
  .sidebar, .topbar, .nav-scrim, #generator-form, #lesson-timer, .result-actions, .page-head, .toast, #lesson-calls, .run-progress { display: none !important; }
  body, .app-shell, .workspace, .workspace-main { background: #fff !important; display: block; padding: 0; color: #000; }
  .panel, .lesson-card { box-shadow: none !important; border-color: #d0d5dd !important; animation: none !important; }
  .lesson-card { break-inside: avoid-page; }
  .lesson-grid { display: block; }
  .lesson-card + .lesson-card { margin-top: 12px; }
  .lesson-prose table { display: table; overflow: visible; }
}

/* ---------- Dodatki AI School poza paczką 2.0 ---------- */
/* Wideo z YouTube: galeria miniatur, film ładuje się po kliknięciu; grający film na całą szerokość karty
   (przy małym okienku YouTube chowa przycisk pełnego ekranu). */
#lesson-sections .video-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
#lesson-sections .video-item { display: grid; align-content: start; gap: 8px; min-width: 0; margin: 0; }
#lesson-sections .video-item.is-playing { grid-column: 1 / -1; }
#lesson-sections .video-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: var(--r-md); background: #0b1020; }
#lesson-sections .video-frame iframe,
#lesson-sections .video-play { display: block; width: 100%; height: 100%; border: 0; }
#lesson-sections .video-play { position: relative; padding: 0; background: #0b1020; cursor: pointer; }
#lesson-sections .video-play img { display: block; width: 100%; height: 100%; object-fit: cover; }
#lesson-sections .video-play-icon { position: absolute; top: 50%; left: 50%; display: flex; width: 52px; height: 52px; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: rgba(8, 12, 24, 0.7); font-size: 20px; transform: translate(-50%, -50%); }
#lesson-sections .video-play:hover .video-play-icon,
#lesson-sections .video-play:focus-visible .video-play-icon { background: var(--accent); }
#lesson-sections .video-play:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
#lesson-sections .video-duration { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 6px; color: #fff; background: rgba(8, 12, 24, 0.8); font-size: 12px; font-weight: 650; }
#lesson-sections .video-item figcaption { display: grid; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.4; }
#lesson-sections .video-item figcaption strong { color: var(--ink); overflow-wrap: anywhere; }
#lesson-sections .video-item figcaption span { color: var(--muted); }
#lesson-sections .video-item figcaption a { color: var(--accent-ink); font-weight: 650; text-decoration: none; }
#lesson-sections .video-query { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
@media print { #lesson-sections .video-frame iframe, #lesson-sections .video-play-icon { display: none !important; } }
/* Postęp generowania lekcji (kolejka z produkcji 02:14) w tokenach wyglądu 2.0 */
.lesson-progress { display: grid; gap: 10px; margin: 4px 0 18px; }
.lesson-progress progress { width: 100%; height: 10px; border: 0; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-3); accent-color: var(--accent); appearance: none; }
.lesson-progress progress::-webkit-progress-bar { background: var(--surface-3); border-radius: var(--r-pill); }
.lesson-progress progress::-webkit-progress-value { background: var(--accent); border-radius: var(--r-pill); transition: width .4s ease; }
.lesson-progress progress::-moz-progress-bar { background: var(--accent); border-radius: var(--r-pill); }
.progress-summary { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.progress-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.progress-step { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; }
.progress-name { font-weight: 700; color: var(--ink); }
.progress-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-step.is-trwa, .progress-step.is-poprawka { border-color: var(--accent-line); background: var(--accent-soft); }
.progress-step.is-trwa .progress-state, .progress-step.is-poprawka .progress-state { color: var(--accent-ink); font-weight: 700; }
.progress-step.is-gotowe { border-color: var(--success-line); background: var(--success-soft); }
.progress-step.is-gotowe .progress-state { color: var(--success-ink); font-weight: 700; }
/* Pulpit-skróty: kafle szybkiego dostępu jako linki */
a.quick, a.quick:hover { text-decoration: none; }
.widget.w-12 .quick-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1080px) { .widget.w-12 .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .widget.w-12 .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Kalendarz: pole godziny jest linkiem (otwiera okno także bez skryptu), a link w linii nie ma wysokości. */
a.hour-slot { display: block; }

/* Wideo: ręczne szukanie w YouTube i podmiana filmu (widok nauczyciela), w tokenach paczki 2.0. */
#lesson-sections .video-item figcaption .video-manual { justify-self: start; margin-top: 4px; }
#lesson-sections .video-mark { justify-self: start; margin-top: 4px; }
#lesson-sections .video-mark[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
#lesson-sections .video-search { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
#lesson-sections .video-search-row { display: flex; gap: 8px; }
#lesson-sections .video-search-row input { flex: 1; min-width: 0; }
#lesson-sections .video-search-status { margin: 0; color: var(--muted); font-size: 13px; }
#lesson-sections .video-search-status:empty { display: none; }
#lesson-sections .video-results { display: grid; gap: 12px; }
#lesson-sections .video-result { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 12px; align-items: start; }
#lesson-sections .video-result.is-playing { grid-template-columns: minmax(0, 1fr); }
#lesson-sections .video-result-text { display: grid; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.4; }
#lesson-sections .video-result-text strong { color: var(--ink); overflow-wrap: anywhere; }
#lesson-sections .video-result-text span { color: var(--muted); }
#lesson-sections .video-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
@media (max-width: 560px) { #lesson-sections .video-result { grid-template-columns: minmax(0, 1fr); } }
@media print { #lesson-sections .video-search, #lesson-sections .video-mark { display: none !important; } }

/* Karty wyniku lekcji: zwinięte, rozwijane kliknięciem w nagłówek (tylko ekran; wydruk pokazuje całość). */
#lesson-sections .lesson-card-head { cursor: pointer; }
.card-toggle { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.card-toggle:hover { background: var(--surface-2); color: var(--ink); }
.card-toggle:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.card-toggle .ico { transform: rotate(90deg); transition: transform .2s ease; }
.lesson-card.is-collapsed .card-toggle .ico { transform: rotate(0deg); }
@media screen {
  .lesson-card.is-collapsed > :not(.lesson-card-head) { display: none !important; }
  .lesson-card.is-collapsed > .lesson-card-head { margin-bottom: 0; }
  .lesson-card.is-collapsed { align-self: start; }
}
@media print { .card-toggle { display: none !important; } }

/* Strzałka „do góry” w generatorze: okrągły przycisk w prawym dolnym rogu. */
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); cursor: pointer; }
.to-top[hidden] { display: none; }
.to-top:hover { filter: brightness(1.08); }
.to-top:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.to-top .ico { width: 22px; height: 22px; }
@media (max-width: 760px) { .to-top { right: 16px; bottom: 16px; } }
@media print { .to-top { display: none !important; } }
