/* ==========================================================================
   custom.css — komponenty aplikacji (karty, przyciski, kolory, wykresy).
   Cały plik jest w warstwie @layer components Tailwinda, więc KLASY TAILWINDA
   W SZABLONACH ZAWSZE WYGRYWAJĄ (np. dopisanie "p-2", "mb-0", "grid-cols-3"
   do .panel działa od razu). Układ (siatki, odstępy, szerokości) najlepiej
   ustawiać klasami Tailwinda w szablonie, a tu trzymać tylko wygląd.
   Nowe klasy Tailwinda: po zmianie szablonów zbuduj CSS:  npm run build
   ========================================================================== */
@layer components {

/* ================================================================ Kolory aplikacji
   Jedno źródło: zielony = gauge Gotowości, czerwony = błędne w "Moja aktywność",
   niebieski = primary. Wersje -dark: hover przycisków i tekst (lepszy kontrast). */
:root {
  --app-green: #14b8a6;
  --app-green-dark: #0d9488;
  --app-red: #ef4444;
  --app-red-dark: #dc2626;
  --app-blue: #2563eb;
  --app-blue-dark: #1d4ed8;
  /* Motyw Flowbite korzysta z tych samych kolorów (bg-brand, bg-success, text-fg-… itd.). */
  --color-brand: var(--app-blue);
  --color-brand-strong: var(--app-blue-dark);
  --color-success: var(--app-green);
  --color-fg-success: var(--app-green-dark);
  --color-danger: var(--app-red);
  --color-fg-danger: var(--app-red-dark);
}

/* AI explanation styling */
.ai-header {
  font-weight: 600;
  font-size: 1.125rem; /* lg */
  margin-bottom: 0.25rem;
}
.ai-explanation {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.ai-signs-list {
  font-style: italic;
  margin-bottom: 0.5rem;
}

/* Confetti overlay shown when a test/exam is passed */
.confetti-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  pointer-events: none;
}

.confetti-field {
  position: absolute;
  inset: 0 3%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.confetti-overlay .piece {
  position: relative;
  top: -18px;
  flex: 0 0 auto;
  border-radius: 2px;
  animation: confetti-fall 2s linear 1 forwards;
}

/* color, every 8 */
.confetti-overlay .piece:nth-child(8n+1) { background: #ff6b6b; }
.confetti-overlay .piece:nth-child(8n+2) { background: #38bdf8; }
.confetti-overlay .piece:nth-child(8n+3) { background: #ffd444; }
.confetti-overlay .piece:nth-child(8n+4) { background: #b8ff57; }
.confetti-overlay .piece:nth-child(8n+5) { background: #f472b6; }
.confetti-overlay .piece:nth-child(8n+6) { background: #57d9a3; }
.confetti-overlay .piece:nth-child(8n+7) { background: #c084fc; }
.confetti-overlay .piece:nth-child(8n)   { background: #ff9040; }

/* shape, every 5 */
.confetti-overlay .piece:nth-child(5n+1) { width: 8px; height: 12px; }
.confetti-overlay .piece:nth-child(5n+2) { width: 12px; height: 8px; border-radius: 50%; }
.confetti-overlay .piece:nth-child(5n+3) { width: 6px; height: 14px; }
.confetti-overlay .piece:nth-child(5n+4) { width: 14px; height: 6px; }
.confetti-overlay .piece:nth-child(5n)   { width: 9px; height: 9px; border-radius: 50%; }

/* fall time, every 7 */
.confetti-overlay .piece:nth-child(7n+1) { animation-duration: 2.05s; }
.confetti-overlay .piece:nth-child(7n+2) { animation-duration: 1.65s; }
.confetti-overlay .piece:nth-child(7n+3) { animation-duration: 2.31s; }
.confetti-overlay .piece:nth-child(7n+4) { animation-duration: 1.78s; }
.confetti-overlay .piece:nth-child(7n+5) { animation-duration: 2.44s; }
.confetti-overlay .piece:nth-child(7n+6) { animation-duration: 1.91s; }
.confetti-overlay .piece:nth-child(7n)   { animation-duration: 2.18s; }

/* start offset, every 11 (negative, scaled) */
.confetti-overlay .piece:nth-child(11n+1)  { animation-delay: -0.45s; }
.confetti-overlay .piece:nth-child(11n+2)  { animation-delay: -0.85s; }
.confetti-overlay .piece:nth-child(11n+3)  { animation-delay: -0.15s; }
.confetti-overlay .piece:nth-child(11n+4)  { animation-delay: -1.025s; }
.confetti-overlay .piece:nth-child(11n+5)  { animation-delay: -0.6s; }
.confetti-overlay .piece:nth-child(11n+6)  { animation-delay: -0.275s; }
.confetti-overlay .piece:nth-child(11n+7)  { animation-delay: -0.975s; }
.confetti-overlay .piece:nth-child(11n+8)  { animation-delay: -0.375s; }
.confetti-overlay .piece:nth-child(11n+9)  { animation-delay: -0.725s; }
.confetti-overlay .piece:nth-child(11n+10) { animation-delay: -0.075s; }
.confetti-overlay .piece:nth-child(11n)    { animation-delay: -1.15s; }

/* nudge off even spacing, every 3 */
.confetti-overlay .piece:nth-child(3n+2) { margin-left: 1.4%; }
.confetti-overlay .piece:nth-child(3n)   { margin-right: 1.8%; }

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg) scaleX(1); opacity: 1; }
  25%  { transform: translateY(6vh) rotate(90deg) scaleX(0); }
  50%  { transform: translateY(25vh) rotate(180deg) scaleX(-1); }
  75%  { transform: translateY(57vh) rotate(270deg) scaleX(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg) scaleX(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-overlay { display: none; }
}

/* Panel "AI debug" - wizualna detekcja znaków (YOLO / OpenCV) */
.ai-det {
  margin-top: 0.5rem;
}
.ai-det-card {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: #ffffff;
}
.ai-det-frame {
  font-weight: 600;
  font-size: 11px;
  color: #111827;
}
.ai-det-head {
  margin-top: 8px;
  font-weight: 600;
  font-size: 11px;
}
.ai-det-hint {
  font-weight: 400;
  color: #6b7280;
}
.ai-det-anno {
  margin-top: 6px;
}
.ai-det-anno img {
  width: 100%;
  max-width: 420px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
.ai-det-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.ai-det-thumb {
  display: block;
  width: 104px;
  flex: 0 0 104px;
  text-decoration: none;
  color: inherit;
}
.ai-det-thumb img {
  width: 104px;
  height: 84px;
  object-fit: contain;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 4px;
}
.ai-det-cap {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  color: #374151;
}
.ai-det-bbox {
  font-size: 9px;
  line-height: 1.2;
  color: #9ca3af;
}
.ai-det-err {
  font-size: 11px;
  color: var(--app-red-dark);
}
.ai-det-empty {
  font-size: 11px;
  color: #6b7280;
}


/* Przełącznik języka pytań (sidebar) */
.lang-switch { margin-top: 1rem; padding: 1rem 0.5rem 0; border-top: 1px solid var(--color-border-default, #e5e7eb); }
.lang-switch label { display: block; margin-bottom: 0.35rem; font-size: 0.75rem; font-weight: 600; opacity: 0.75; }
.lang-switch select { width: 100%; padding: 0.4rem 0.5rem; font-size: 0.875rem; border: 1px solid var(--color-border-default, #d1d5db); border-radius: 0.5rem; background: #fff; }

/* Komunikaty (flash) */
.flash-msg { margin-bottom: 1rem; padding: 0.75rem 1rem; border: 1px solid #fcd34d; border-radius: 0.5rem; background: #fffbeb; color: #92400e; font-size: 0.875rem; }

/* ================================================================ Postępy (dashboard) */
.dash-hero { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.dash-hero h2 { margin-bottom: 0.5rem; }
.dash-hero-body { flex: 1; min-width: 260px; }
.ready-ring {
  --p: 0; flex: 0 0 auto; width: 132px; height: 132px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(closest-side, var(--color-neutral-primary, #fff) 78%, transparent 79%),
    conic-gradient(var(--color-brand, var(--app-blue)) calc(var(--p) * 1%), #e5e7eb 0);
}
.ready-ring.is-ready { background:
    radial-gradient(closest-side, var(--color-neutral-primary, #fff) 78%, transparent 79%),
    conic-gradient(var(--app-green) calc(var(--p) * 1%), #e5e7eb 0); }
.ready-num { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--color-fg-brand, #1e40af); }
.ready-ring.is-ready .ready-num { color: var(--app-green-dark); }
.ready-lbl { font-size: 0.75rem; opacity: 0.7; }
.checklist { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.checklist li { position: relative; padding: 0.3rem 0 0.3rem 1.7rem; }
.checklist li::before { content: "○"; position: absolute; left: 0.2rem; top: 0.3rem; color: #9ca3af; font-weight: 700; }
.checklist li.done::before { content: "✓"; color: var(--app-green); }

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { margin-bottom: 0 !important; }
.panels-3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.stack-bar { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: #e5e7eb; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 0.75rem; font-size: 0.85rem; }
.stack-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; }
.seg-mastered { background: var(--app-green); }
.seg-learning { background: #86efac; }
.seg-review   { background: #f97316; }
.seg-new      { background: #d1d5db; }

.bar-fill.acc-good { background: var(--app-green); }
.bar-fill.acc-mid  { background: #f59e0b; }
.bar-fill.acc-bad  { background: var(--app-red); }
a.bar-label { color: inherit; text-decoration: underline dotted; }

.chip { display: inline-block; margin-right: 0.4rem; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: #f3f4f6; color: #4b5563; vertical-align: middle; }
.chip-due { background: #ffedd5; color: #c2410c; }

.act-chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; }
.act-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.act-bar-wrap { height: 110px; width: 100%; display: flex; align-items: flex-end; }
.act-bar { width: 100%; min-height: 2px; background: #bfdbfe; border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; overflow: hidden; }
.act-ok { width: 100%; background: var(--color-brand, var(--app-blue)); }
.act-n { font-size: 0.7rem; font-weight: 600; min-height: 1em; }
.act-d { font-size: 0.65rem; opacity: 0.6; }

.sign-weak { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.sign-weak figure { margin: 0; padding: 0.6rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; text-align: center; font-size: 0.75rem; }
.sign-weak img { height: 70px; width: auto; margin: 0 auto 0.4rem; object-fit: contain; }

/* Karta gotowości na stronie głównej */
.home-ready { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.home-ready .ready-ring { width: 96px; height: 96px; }
.home-ready .ready-num { font-size: 1.4rem; }

/* Quiz znaków — tryby */
.quiz-modes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.quiz-modes a { padding: 0.3rem 0.75rem; border: 1px solid #d1d5db; border-radius: 999px; font-size: 0.8rem; color: inherit; text-decoration: none; }
.quiz-modes a.active { background: var(--color-brand, var(--app-blue)); border-color: transparent; color: #fff; }

/* Quiz znaków wg Figma (313826-20855): znak na środku, pod nim karta odpowiedzi. */
.sign-title { font-size: 1.5rem; font-weight: 400; line-height: 1.3; color: #1e1e1e; margin-bottom: 1.5rem; }
.sign-question { display: flex; flex-direction: column; align-items: center; gap: 2.5rem; width: 100%; }
.sign-stage { display: flex; justify-content: center; width: 100%; }
.sign-img { width: 320px; height: 320px; max-width: 80vw; object-fit: contain; }
.sign-form { width: 100%; max-width: 640px; }
/* Quiz znaków: jedna ramka wokół wszystkich odpowiedzi (kolor obramowań aplikacji), w środku tylko kreski między nimi. */
.sign-answers {
  width: 100%; background: #fff; border: var(--ui-card-border); border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sign-answers .answer-btn {
  min-height: 3.5rem; gap: 0.75rem; padding: 0.5rem; font-size: 1rem;
  border-color: #e5e7eb; border-bottom: 1px solid #e5e7eb;
}
.sign-answers .answer-btn:last-child { border-bottom: 0; }
.sign-answers .key {
  width: 2.5rem; height: 2.5rem; border-radius: 0.5rem; background: #dbeafe; color: #1e40af;
  font-size: 0.875rem; font-weight: 500;
}
/* Po wyborze: jasne tło i tekst w kolorze wyniku (ogólne .answer-btn.correct/.wrong w app.css dają biały tekst). */
/* Po wyborze: jasne tło i tekst w kolorze wyniku. Bez własnej ramki, cienia i obwódki z ogólnego
   .answer-btn.correct/.wrong (app.css, egzamin) — zostaje tylko kreska oddzielająca jak w pozostałych wierszach. */
.sign-answers .answer-btn.correct, .sign-answers .answer-btn.correct:hover, .sign-answers .answer-btn.correct:focus,
.sign-answers .answer-btn.wrong, .sign-answers .answer-btn.wrong:hover, .sign-answers .answer-btn.wrong:focus {
  border: 0; border-bottom: 1px solid #e5e7eb; box-shadow: none; outline: none; font-weight: 500;
}
.sign-answers .answer-btn.correct, .sign-answers .answer-btn.correct:hover, .sign-answers .answer-btn.correct:focus {
  background: #f0fdfa; color: var(--app-green-dark);
}
.sign-answers .answer-btn.wrong, .sign-answers .answer-btn.wrong:hover, .sign-answers .answer-btn.wrong:focus {
  background: #fef2f2; color: var(--app-red-dark);
}
.sign-answers .answer-btn.correct:last-child, .sign-answers .answer-btn.wrong:last-child { border-bottom: 0; }
.sign-answers .key.correct { background: var(--app-green); color: #fff; }
.sign-answers .key.wrong { background: var(--app-red); color: #fff; }
@media (max-width: 640px) {
  .sign-answers .answer-btn { font-size: 0.9rem; }
}

/* Szybki test / egzamin wg Figma 313814:5955. */
.exam-shell .exam-aside { width: 264px; }
@media (max-width: 1023px) {
  .exam-shell .exam-aside { width: 100%; }
}
.exam-shell .media-box { width: 100%; height: 360px; border-radius: 8px; overflow: hidden; background: #f3f4f6; }
.exam-shell .media-box img, .exam-shell .media-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.exam-shell #question-text {
  margin: 1.5rem 0; padding: 0; border: 0; background: none;
  font-size: 1.5rem; font-weight: 400; line-height: 1.3; color: #1e1e1e;
}
/* Tak / Nie: dwa kafelki obok siebie. */
.exam-shell .exam-answers.answers-yn { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; border: 0; background: none; overflow: visible; }
.exam-shell .exam-answers .answer-btn.tak-nie {
  min-height: 3.75rem; justify-content: center; border: 0; border-radius: 8px; background: #dbeafe;
  color: #1e40af; font-size: 0.875rem; font-weight: 500;
}
.exam-shell .exam-answers .answer-btn.tak-nie:hover:not(:disabled) { background: #bfdbfe; }
/* Zaznaczona odpowiedź (przed werdyktem): pełny niebieski z białym tekstem wg Figma 313814:8096. */
.exam-shell .exam-answers .answer-btn.selected { background: var(--app-blue); border-color: var(--app-blue); color: #fff; }
.exam-shell .exam-answers .answer-btn.tak-nie.selected .key { color: #fff; }
.exam-shell .exam-answers .answer-btn.selected .key { color: #fff; }
.exam-shell .exam-answers:not(.answers-yn) .answer-btn.selected .key { background: var(--app-blue-dark); }
/* Werdykt w quizie: poprawna zielona, błędna czerwona. Mocniejsze niż tło kafelka. */
.exam-shell .exam-answers .answer-btn.correct { background: var(--app-green); border-color: var(--app-green); color: #fff; }
.exam-shell .exam-answers .answer-btn.wrong { background: var(--app-red); border-color: var(--app-red); color: #fff; }
.exam-shell .exam-answers .answer-btn .key.correct { background: var(--app-green-dark); color: #fff; }
.exam-shell .exam-answers .answer-btn .key.wrong { background: var(--app-red-dark); color: #fff; }
.exam-shell .exam-answers .answer-btn.tak-nie.correct .key,
.exam-shell .exam-answers .answer-btn.tak-nie.wrong .key { background: none; color: #fff; }
.exam-shell .exam-answers .answer-btn.tak-nie .key { background: none; color: #1e40af; width: auto; height: auto; font-size: 0.875rem; font-weight: 500; }
/* Wielokrotny wybór A/B/C: lista w jednej karcie, jak na quizie znaków. */
.exam-shell .exam-answers:not(.answers-yn) {
  width: 100%; background: #fff; border: 0; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.exam-shell .exam-answers:not(.answers-yn) .answer-btn { min-height: 3.5rem; border-color: #e5e7eb; border-bottom: 1px solid #e5e7eb; }
.exam-shell .exam-answers:not(.answers-yn) .answer-btn:last-child { border-bottom: 0; }
.exam-shell .exam-answers:not(.answers-yn) .key {
  width: 2.5rem; height: 2.5rem; border-radius: 0.5rem; background: #dbeafe; color: #1e40af;
  font-size: 0.875rem; font-weight: 500;
}
/* Prawa kolumna: żółty przycisk, liczniki, karta akcji. */
.exam-shell #btn-finish {
  width: 100%; height: 2.75rem; border-radius: 8px; border: 0;
  background: #eab308; color: #fff; font-size: 0.875rem; font-weight: 500;
}
.exam-shell #points-bar {
  height: 2.75rem; margin-bottom: 0.75rem; border-radius: 8px; border: 0;
  background: #dbeafe; color: #1e40af; font-size: 0.875rem; font-weight: 500;
}
.exam-shell .exam-counters { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0 0; }
.exam-shell .exam-counter-label { margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: #000; }
.exam-shell .counter-box {
  height: 2.75rem; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #000;
  font-size: 0.875rem; font-weight: 500;
}
.exam-shell .counter-box.active { background: #dbeafe; border-color: #dbeafe; color: #1e40af; }
.exam-shell .exam-actions {
  margin-top: 1.5rem; padding: 1rem; border-radius: 16px; background: #f8fafc;
  display: flex; flex-direction: column; gap: 1rem;
}
.exam-shell .exam-actions .btn {
  height: 2.75rem; border-radius: 8px; border: 1px solid var(--app-blue); background: #fff;
  color: var(--app-blue); font-size: 0.875rem; font-weight: 500; box-shadow: none; justify-content: center;
}
.exam-shell .exam-actions .btn:hover { background: #eff6ff; }
.exam-shell #btn-abandon { border-color: var(--app-red); color: var(--app-red); }
.exam-shell #btn-abandon:hover { background: #fef2f2; }

/* Postępy wg Figma 313832:7907. */
.stats-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0 1rem; }
.stats-kpis { align-items: stretch; }
.stats-kpis .dash-kpi { min-height: 100%; padding: 1rem 0.75rem; } /* wygląd karty: blok „Wspólny wygląd” */
.stats-kpis .dash-gauge svg { max-width: 152px; }
.stats-kpis .dash-gauge .g-text { margin-top: -1.6rem; }
.stats-kpis .dash-count strong { font-size: 1.5rem; font-weight: 600; }
.stats-kpis .dash-count span { font-size: 1rem; }
.stats-cards { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
.stats-cards .dash-card { min-height: 177px; padding: 1rem; background: #f8fafc; border: 0; border-radius: 16px; box-shadow: none; }
.stats-cards .dash-card h2 { font-size: 1.5rem; font-weight: 600; color: #1e1e1e; }
.stats-cards .dash-card > p { font-size: 1rem; color: #1e1e1e; }
.stats-cards .dash-card > .dash-btn { align-self: flex-end; height: 2.75rem; }
.stats-activity { margin-bottom: 1.5rem; padding: 1rem; background: #fff; border-radius: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stats-activity h2 { margin-bottom: 1rem; font-size: 1.5rem; font-weight: 600; color: #1e1e1e; }
.stats-activity .stack-bar { height: 24px; border-radius: 16px; }
.stats-activity .seg-mastered { background: var(--app-green); }
.stats-activity .seg-learning { background: var(--app-blue); }
.stats-activity .seg-review { background: #eab308; }
.stats-activity .seg-new { background: #e5e7eb; }
@media (min-width: 900px) {
  .stats-cards { grid-template-columns: 1fr 1.05fr; }
}
@media (max-width: 900px) {
  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tabela "Do powtórki" wg Preline "Order Table with Search and Filters" (własny CSS, bez kodu PRO). */
.wtable-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.wtable-tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid #e5e7eb; }
.wtable-tabs button {
  margin-bottom: -1px; padding: 0.5rem 0; border-bottom: 2px solid transparent;
  background: none; color: #6b7280; font-size: 0.9rem; font-weight: 500; cursor: pointer;
}
.wtable-tabs button.is-active { color: #1e1e1e; border-bottom-color: #1e1e1e; }

/* Poziome zakładki w Postępach (Gotowość, Pytania do powtórki, Znaki, Egzaminy, Szybkie testy). */
.stats-tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 1rem; flex-wrap: wrap; }
.stats-tabs button {
  margin-bottom: -1px; padding: 0.5rem 0; border-bottom: 2px solid transparent;
  background: none; color: #6b7280; font-size: 0.95rem; font-weight: 500; cursor: pointer;
}
.stats-tabs button.is-active { color: #1e1e1e; border-bottom-color: #1e1e1e; }
.stats-tabpanel { display: none; }
.stats-tabpanel.is-active { display: block; }
.wtable-tools { display: flex; align-items: center; gap: 0.75rem; }
#wtable-search {
  height: 2.5rem; min-width: 16rem; padding: 0 0.75rem; font-size: 0.9rem;
  border: 1px solid #e5e7eb; border-radius: 0.5rem; background: #f3f4f6; color: #1e1e1e;
}
#wtable-search:focus { outline: 2px solid #93c5fd; outline-offset: 1px; }
.wtable-wrap tbody tr[hidden] { display: none; }
.wtable-wrap input[type="checkbox"] { width: 1rem; height: 1rem; cursor: pointer; }

/* Pływający przycisk Asystenta AI wg Figma 313803:870. */
.ai-bubble {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 64px; height: 64px; display: grid; place-items: center;
  border: 1px solid #fff; border-radius: 9999px; background: var(--app-blue); color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,.35); cursor: pointer;
  transition: background-color .15s ease;
}
.ai-bubble:hover { background: var(--app-blue-dark); }
.ai-bubble:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
.ai-bubble svg { width: 32px; height: 32px; }

/* Odznaka aktualnego pytania nad czatem wg easyui "Prompt Input" (chip załącznika). */
.ai-ctx-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.25rem; max-width: 100%;
  padding: 0.25rem 0.25rem 0.25rem 0.25rem; border: 0; border-radius: 0.75rem;
  background: rgba(0,0,0,.04); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  color: #1e1e1e; font-size: 0.8rem; font-weight: 500;
}
.ai-ctx-chip.is-on { background: #eff6ff; box-shadow: inset 0 0 0 1px #bfdbfe; }
.ai-ctx-chip.is-off { padding: 0 0.75rem; color: #6b7280; cursor: pointer; }
.ai-ctx-chip.is-off:hover { background: rgba(0,0,0,.07); }
.ai-ctx-mark {
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem; flex-shrink: 0;
  border-radius: 0.5rem; background: #fff; color: var(--app-blue); font-size: 0.75rem; font-weight: 700;
}
.ai-ctx-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 0.25rem; }
.ai-ctx-x {
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem; flex-shrink: 0;
  border: 0; border-radius: 0.5rem; background: transparent; color: #6b7280;
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.ai-ctx-x:hover { background: rgba(0,0,0,.06); color: #1e1e1e; }

/* ---- Czat AI w stylu easyui "Chat" (jasny motyw). Klasy ai-bub/ai-avatar nadaje ai-drawer.js. ---- */
#ai-drawer { background: #fff; }
#ai-drawer > div:first-child { background: #fff; border-bottom: 1px solid rgba(229,231,235,.8); }
#ai-drawer .ai-bub { border-radius: 1rem; font-size: 0.8125rem; line-height: 1.55; padding: 0.75rem 0.875rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
#ai-drawer .ai-bub-asst { background: #f5f5f5; border: 1px solid #e5e7eb; border-top-left-radius: 0.25rem; color: #171717; }
#ai-drawer .ai-bub-user { background: #171717; color: #fff; border-top-right-radius: 0.25rem; max-width: 85%; padding: 0.625rem 0.875rem; }
#ai-drawer .ai-bub-user span { opacity: 0.7; }
#ai-drawer .ai-avatar {
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem; flex-shrink: 0;
  border-radius: 0.5rem; border: 1px solid #e5e7eb; background: #f5f5f5; color: #171717;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
#ai-composer { background: #fff; border-top: 1px solid rgba(229,231,235,.8); }
#ai-input {
  border-radius: 0.75rem; background: #fff; border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); font-size: 0.875rem; color: #171717;
}
#ai-input:focus { border-color: #a3a3a3; outline: none; }
#ai-send { background: #171717; border: 0; border-radius: 0.75rem; }
#ai-send:hover { background: #404040; }
#ai-suggestions button {
  border-radius: 0.5rem; border: 1px solid #e5e7eb; background: #fff; color: #171717;
  font-size: 0.75rem; padding: 0.375rem 0.625rem;
}
#ai-suggestions button:hover { background: #f5f5f5; }

/* ---- Stopka sidebaru: profil, menu ⋮ (Ustawienia, Wyloguj) ---- */
.sb-profile { margin-top: auto; padding: 0.75rem 0.5rem 0.5rem; border-top: 1px solid #e5e7eb; position: relative; }
.sb-profile-btn {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; padding: 0.5rem;
  border: 0; border-radius: 0.5rem; background: transparent; text-align: left; cursor: pointer; color: #1e1e1e;
}
.sb-profile-btn:hover { background: #f3f4f6; }
.sb-avatar {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  border-radius: 999px; background: #dbeafe; color: #1e40af; font-size: 0.9rem; font-weight: 600;
}
.sb-who { display: flex; flex: 1; min-width: 0; align-items: center; gap: 0.375rem; }
.sb-role {
  flex-shrink: 0; padding: 0.0625rem 0.4375rem; border-radius: 999px;
  background: #f3f4f6; color: #4b5563; font-size: 0.6875rem; font-weight: 600; line-height: 1.125rem;
}
.sb-role-teacher { background: #ffe4e6; color: var(--app-red-dark); }
.sb-name { min-width: 0; font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-more { width: 1.25rem; height: 1.25rem; flex-shrink: 0; color: #6b7280; }
.sb-menu {
  width: 13rem; padding: 0.25rem; z-index: 60;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem; box-shadow: 0 10px 25px rgba(0,0,0,.12);
}
.sb-menu.hidden { display: none; }
.sb-menu-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0.625rem;
  border: 0; border-radius: 0.5rem; background: none; color: #1e1e1e; font-size: 0.875rem; text-align: left; text-decoration: none; cursor: pointer;
}
.sb-menu-item:hover { background: #f3f4f6; text-decoration: none; }
.sb-menu-icon { width: 1rem; height: 1rem; flex-shrink: 0; color: #6b7280; }
.sb-menu-danger, .sb-menu-danger .sb-menu-icon { color: var(--app-red-dark); }
.sb-profile-guest { margin-top: auto; }
.sb-profile-guest .sb-menu-item { padding: 0.5rem; }

/* ---- Strona Ustawienia ---- */
.settings-panel { margin-bottom: 1rem; }
.settings-panel h2 { margin-bottom: 0.75rem; font-size: 1.125rem; font-weight: 600; color: #1e1e1e; }
.settings-lang { margin-top: 0; padding: 0; border: 0; max-width: 18rem; }
.settings-update { margin-top: 0; padding: 0; border: 0; }
.settings-update .update-btn { width: auto; }

/* ---- Kod zaproszenia jako OTP (6 pól), wzór easyui "OTP Input", jasny motyw ---- */
.otp { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.25rem; }
.otp-box {
  width: 2.75rem; height: 3.25rem; padding: 0; text-align: center;
  font-size: 1.5rem; font-weight: 600; color: #171717; font-variant-numeric: tabular-nums;
  background: #fff; border: 1px solid #d4d4d4; border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.otp-box:focus { border-color: var(--app-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.otp-box.is-filled { border-color: #a3a3a3; }
.otp.is-error .otp-box { border-color: var(--app-red-dark); }
@media (max-width: 380px) {
  .otp { gap: 0.35rem; }
  .otp-box { width: 2.35rem; height: 2.9rem; font-size: 1.25rem; }
}

/* ---- Pola hasła w stylu easyui "LockInput": fokus "wskakuje na miejsce" ---- */
.lock-form { display: flex; flex-direction: column; gap: 0.875rem; max-width: 26rem; margin-top: 0.5rem; }
.lock-group { display: flex; flex-direction: column; gap: 0.375rem; }
.lock-label { font-size: 0.875rem; font-weight: 500; color: #171717; }
.lock-field { position: relative; }
.lock-field::after {
  content: ""; position: absolute; inset: -3px; border-radius: 0.625rem;
  border: 2px solid var(--app-blue); opacity: 0; transform: scale(0.92); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(.22,.61,.36,1);
}
.lock-field:focus-within::after { opacity: 0.35; transform: scale(1); }
.lock-input {
  width: 100%; height: 2.75rem; padding: 0 0.875rem; font-size: 1rem; color: #171717;
  background: #fff; border: 1px solid #d4d4d4; border-radius: 0.5rem; outline: none;
  transition: border-color 0.2s ease;
}
.lock-input:focus { border-color: var(--app-blue); }
.lock-input:user-invalid { border-color: var(--app-red); }
.form-hint { font-size: 0.8125rem; line-height: 1.5; color: #6b7280; }

/* ---- Półkola z segmentami (easyui "Donut Chart", tryb Gauge): podświetlenie i legenda ---- */
.dash-gauge .g-seg { fill: none; stroke-width: 12; stroke-linecap: round; cursor: pointer; transition: opacity 0.2s ease; }
.gauge-box.is-hover .g-seg, .gauge-box.is-hover .g-seg-d { opacity: 0.3; }
.gauge-box.is-hover .g-seg.is-hover, .gauge-box.is-hover .g-seg-d.is-hover { opacity: 1; }
.gauge-box .g-seg.is-off, .gauge-box .g-seg-d.is-off { opacity: 0; pointer-events: none; }

/* Tryb Donut (pełne koło z odstępami, wzór easyui). Styl jest globalny: klasa chart-donut na <html>,
 * ustawiana w static/js/gauge.js z ustawienia w Ustawieniach. */
.g-stage { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; }
.g-svg-donut { display: none; width: 100%; max-width: 180px; height: auto; overflow: visible; }
:root.chart-donut .g-svg-gauge { display: none; }
:root.chart-donut .g-svg-donut { display: block; }
.g-track-d { fill: none; stroke: #e5e7eb; stroke-width: 12; }
.g-seg-d { fill: none; stroke-width: 12; stroke-linecap: round; cursor: pointer; transition: opacity 0.2s ease; }
:root.chart-donut .gauge-box .g-text {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
  text-align: center; pointer-events: none;
}
:root.chart-donut .gauge-box .g-text strong { font-size: 1.5rem; }

/* Przełącznik stylu wykresów w Ustawieniach */
.chart-style {
  display: inline-flex; gap: 0.125rem; padding: 0.125rem; margin-top: 0.5rem;
  border-radius: 0.5rem; background: #f3f4f6; font-size: 0.875rem;
}
.chart-style-btn { padding: 0.375rem 0.75rem; border: 0; border-radius: 0.375rem; background: transparent; color: #6b7280; font-weight: 500; cursor: pointer; }
.chart-style-btn[aria-pressed="true"] { background: #fff; color: #171717; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.g-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0.5rem; list-style: none; margin: 0.5rem 0 0; padding: 0; }
.g-legend-item {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.375rem;
  border: 0; border-radius: 0.375rem; background: none; font-size: 0.75rem; color: #374151; cursor: pointer;
  transition: opacity 0.15s ease;
}
.g-legend-item:hover { background: #f3f4f6; }
.g-legend-item i { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 999px; }
.g-legend-item b { font-weight: 600; color: #171717; }
.g-legend-item[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }

.bar-row.bar-row-mid  { grid-template-columns: 110px 1fr 80px; }
.bar-row.bar-row-wide { grid-template-columns: 170px 1fr 130px; }
@media (max-width: 640px) { .bar-row.bar-row-wide { grid-template-columns: 110px 1fr 90px; } }
.bar-value small { opacity: 0.75; }
.table td.link-cell { font-weight: 400 !important; color: inherit !important; text-align: right; }
.table td.link-cell a { color: var(--color-fg-brand, #1e40af); text-decoration: underline; }
.row-pass td.verdict-cell { font-weight: 700; color: var(--app-green-dark); }
.row-fail td.verdict-cell { font-weight: 700; color: var(--app-red-dark); }
.chart .bar-chart { max-width: 48px; }
.chart .bar-chart:not(.fail) { background: var(--app-green); }

/* Przycisk "Aktualizuj" (sidebar) */
.app-update { margin-top: auto; padding: 1rem 0.5rem 0; border-top: 1px solid var(--color-border-default, #e5e7eb); }
.update-btn { width: 100%; gap: 0.5rem; }
.update-btn:disabled { opacity: 0.6; cursor: wait; }
.update-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--app-red-dark); flex: none; }
.update-dot.hidden { display: none; }
.update-msg { margin: 0.5rem 0 0; font-size: 0.75rem; line-height: 1.35; }
.update-msg:empty { display: none; }
.update-msg.is-ok { color: var(--app-green-dark); }
.update-msg.is-error { color: var(--app-red-dark); }
.update-ver { margin: 0.4rem 0 0; font-size: 0.7rem; opacity: 0.55; text-align: center; }

/* Znaki drogowe — rozwijany opis na karcie */
.sign-desc summary::-webkit-details-marker { display: none; }
.sign-desc .sign-desc-close { display: none; }
.sign-desc[open] .sign-desc-open { display: none; }
.sign-desc[open] .sign-desc-close { display: inline; }
.sign-desc .sign-desc-icon { transition: transform 0.2s; }
.sign-desc[open] .sign-desc-icon { transform: rotate(180deg); }

/* Czat "Asystent AI" (drawer z prawej) */
.ai-drawer-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(17, 24, 39, 0.4); }
.ai-drawer-backdrop.hidden { display: none; }
#ai-drawer:focus { outline: none; }
.ai-typing { display: inline-flex; gap: 4px; padding: 0.35rem 0; }
.ai-typing span { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; animation: ai-blink 1.2s infinite ease-in-out; }
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Treść wiadomości AI: media mieszczą się w dymku i nie rozpychają tekstu */
.ai-msg-body { min-width: 0; overflow-wrap: break-word; line-height: 1.6; }
.ai-msg-body > * + * { margin-top: 0.6rem; }
.ai-msg-body p { margin: 0; }
.ai-msg-body ul { list-style: disc; padding-left: 1.25rem; margin: 0; }
.ai-msg-body ol { list-style: decimal; padding-left: 1.25rem; margin: 0; }
.ai-msg-body li + li { margin-top: 0.2rem; }
.ai-msg-body strong { color: var(--color-heading, #111827); }
.ai-msg-body code { font-size: 0.85em; padding: 0.05rem 0.3rem; border-radius: 4px; background: rgba(0,0,0,0.06); }
.ai-msg-body .prose { max-width: none; }
.ai-msg-body img, .ai-msg-body video, .ai-msg-body svg, .ai-msg-body canvas { max-width: 100%; height: auto; }
.ai-msg-body video { border-radius: 0.5rem; }
.ai-msg-body [data-ai="media"] { display: none; }          /* zastępczy obrazek "brak zdjęcia" */
.ai-msg-body [data-ai="header"] { font-weight: 600; color: var(--color-heading, #111827); }

/* Karty znaków: obrazek po lewej, opis po prawej; na wąskim ekranie opis pod obrazkiem */
.ai-msg-body [data-ai="signs"] { display: grid !important; grid-template-columns: 1fr; gap: 0.5rem; margin-top: 0.75rem; }
.chat-sign,
.ai-msg-body [data-ai="signs"] > div {
  display: grid !important; grid-template-columns: 52px minmax(0, 1fr); gap: 0.75rem; align-items: center;
  padding: 0.6rem 0.75rem !important; border: 1px solid var(--color-default, #e5e7eb); border-radius: 0.6rem;
  background: var(--color-neutral-primary, #fff);
  width: 100%; justify-self: stretch; box-sizing: border-box; text-align: left;
}
.chat-sign-img,
.ai-msg-body [data-ai="signs"] > div > img { width: 52px !important; height: 52px !important; object-fit: contain; overflow: hidden; font-size: 0; }
.chat-sign-text { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; min-width: 0; text-align: left; }
.chat-sign-name { font-size: 0.8rem; font-weight: 600; color: var(--color-heading, #111827); }
.chat-sign-desc,
.ai-msg-body [data-ai="signs"] > div > p { font-size: 0.78rem; line-height: 1.4; margin: 0 !important; }
@media (max-width: 380px) {
  .chat-sign, .ai-msg-body [data-ai="signs"] > div { grid-template-columns: 1fr; justify-items: start; }
}
.ai-debug summary::-webkit-details-marker { color: #9ca3af; }
.sign-exam-tip { padding-left: 0.75rem; border-left: 3px solid #f59e0b; }

/* ---------- Sidebar w stylu projektu Figma (Preline) ---------- */
.sidebar-figma { width: 260px; }
.sidebar-figma .sb-inner { padding: 12px; }
.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-heading, #1f2937);
  text-decoration: none;
}
.sb-logo:hover { text-decoration: none; }
.sb-section {
  margin: 12px 0 0;
  padding: 0 16px;
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: #9ca3af;
}
.sb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sb-sub { margin-left: 16px; padding-left: 12px; border-left: 2px solid #e5e7eb; }
.sb-item > a,
.sb-item > button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: var(--color-heading, #1f2937);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.sb-item > a:hover,
.sb-item > button:hover { background: #f3f4f6; text-decoration: none; }
.sb-item.is-active > a { background: #f3f4f6; }
.sb-item .sb-icon { width: 20px; height: 20px; flex-shrink: 0; }
.sb-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--app-red, #ef4444); color: #fff; font-size: 11px; font-weight: 600; line-height: 1;
}
.sb-badge[hidden] { display: none; }
.sb-offset { margin-inline-start: 0; }
@media (min-width: 640px) {
  .sb-offset { margin-inline-start: 260px; }
}

/* ---------- Dashboard (Start) w stylu projektu Figma ---------- */
.dash-head { margin: 0.5rem 0 1.5rem; }
.dash-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.25rem); font-weight: 700; line-height: 1.2; color: var(--color-heading, #111827); }
.dash-head p { margin-top: 0.4rem; font-size: 1.125rem; color: var(--color-body, #4b5563); }

.dash-kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.dash-kpi {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 130px; padding: 1rem 0.75rem;
  background: var(--color-neutral-primary, #fff);
  border: 1px solid var(--color-border-default, #e5e7eb);
  border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(0,0,0,.05);
  text-decoration: none; color: inherit;
}
.dash-count strong { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--color-heading, #111827); }
.dash-count span { margin-top: 0.5rem; font-size: 0.95rem; color: var(--color-body, #4b5563); }
a.dash-count:hover { border-color: #93c5fd; }

.dash-gauge { position: relative; }
.dash-gauge svg { width: 100%; max-width: 170px; height: auto; overflow: visible; }
.dash-gauge .g-track { fill: none; stroke: #e5e7eb; stroke-width: 12; stroke-linecap: round; }
.dash-gauge .g-fill { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.dash-gauge .g-text { display: flex; flex-direction: column; align-items: center; margin-top: -2.2rem; }
.dash-gauge .g-text strong { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--color-heading, #111827); }
.dash-gauge .g-text small { font-size: 0.9rem; }
.dash-gauge .g-text span { margin-top: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--color-heading, #111827); }

.dash-card {
  display: flex; flex-direction: column; gap: 0.75rem; padding: 1.25rem;
  background: var(--color-neutral-primary, #fff);
  border: 1px solid var(--color-border-default, #e5e7eb);
  border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.dash-card h2 { font-size: 1.25rem; font-weight: 700; color: var(--color-heading, #111827); }
.dash-card > p { flex: 1; font-size: 0.95rem; line-height: 1.5; color: var(--color-body, #4b5563); }
.dash-card > .dash-btn { margin-top: auto; }
.dash-card-brand { background: var(--color-fg-brand); color: var(--color-neutral-primary); }
.dash-card-brand h2, .dash-card-brand > p { color: inherit; }
.dash-form .dash-check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; color: var(--color-body, #4b5563); }

.dash-btn {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-end;
  padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: 500; border-radius: 0.5rem;
  border: 1px solid var(--app-blue); color: var(--app-blue-dark); background: #fff; text-decoration: none; cursor: pointer;
}
.dash-btn:hover { background: #eff6ff; text-decoration: none; }
.dash-btn-primary { background: var(--app-blue); color: #fff; }
.dash-btn-primary:hover { background: var(--app-blue-dark); color: #fff; }
.dash-btn-outline { background: #fff; }

.dash-activity { margin-bottom: 2rem; }
.dash-bars { display: flex; gap: 6px; align-items: flex-end; height: 160px; margin-top: 0.5rem; padding-top: 0.5rem; border-bottom: 1px solid #e5e7eb; }
.dash-day { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.dash-stack { width: 100%; max-width: 14px; display: flex; flex-direction: column; border-radius: 999px; overflow: hidden; }
.dash-wrong { background: var(--app-red); min-height: 0; }
.dash-ok { background: var(--app-green); min-height: 0; }
.dash-date { margin-top: 0.4rem; font-size: 0.7rem; color: var(--color-body, #6b7280); white-space: nowrap; }
.dash-activity-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 1rem; font-size: 0.85rem; color: var(--color-body, #6b7280); }
.dash-activity-foot .dash-btn { align-self: auto; }
@media (max-width: 480px) {
  .dash-bars { gap: 3px; }
  .dash-date { font-size: 0.55rem; }
}

/* ---------- Zakładka Nauka w stylu projektu Figma ---------- */

.nauka-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.25rem;
  margin-bottom: 1rem; padding: 1rem;
  background: var(--color-neutral-primary, #fff);
  border: 1px solid var(--color-border-default, #e5e7eb); border-radius: 0.75rem;
}
.nauka-group { display: flex; flex-direction: column; gap: 0.35rem; }
.nauka-label { font-size: 0.8rem; font-weight: 600; color: var(--color-heading, #111827); }
.nauka-seg {
  display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--app-blue); border-radius: 0.5rem; overflow: hidden; height: 40px;
}
.nauka-seg button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.75rem; font-size: 0.85rem; font-weight: 500; color: var(--app-blue);
  background: #fff; border: 0; border-right: 1px solid #bfdbfe; cursor: pointer;
}
.nauka-seg button:last-child { border-right: 0; }
.nauka-seg button:hover { background: #eff6ff; }
.nauka-seg button.is-active { background: var(--app-blue); color: #fff; }
.nauka-seg button svg { width: 14px; height: 14px; fill: currentColor; }
.nauka-count {
  display: inline-block; min-width: 1.4rem; padding: 0 0.35rem; border-radius: 999px;
  font-size: 0.7rem; line-height: 1.2rem; text-align: center; background: #dbeafe; color: var(--app-blue-dark);
}
.nauka-seg button.is-active .nauka-count { background: #fff; color: var(--app-blue); }
.nauka-search { flex: 1 1 260px; min-width: 220px; }
.nauka-search input {
  width: 100%; height: 2.5rem; padding: 0 0.75rem; font-size: 0.9rem;
  border: 1px solid var(--color-border-default, #d1d5db); border-radius: 0.5rem; background: #fff;
}
.nauka-extra { display: flex; align-items: flex-end; gap: 1rem; font-size: 0.85rem; color: var(--color-heading, #111827); }
.nauka-extra label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
.nauka-select {
  min-width: 10rem; height: 2.5rem; padding: 0 2.25rem 0 0.75rem; font-size: 0.875rem;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border-radius: 0.5rem; border: 1px solid var(--color-border-default, #d1d5db); background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 1rem;
  color: var(--color-heading, #1e1e1e);
}
.nauka-select:focus { outline: 2px solid #93c5fd; outline-offset: 1px; }
.nauka-extra .nauka-check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; color: var(--color-body, #4b5563); }
.nauka-meta { margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--color-body, #6b7280); }

.nauka-list { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; margin: 0 auto; }
/* Widok Wiersze: wideo po lewej, pytanie po prawej. */
.nauka-list[data-view="rows"] .nauka-card { display: flex; flex-direction: row; align-items: stretch; }
.nauka-list[data-view="rows"] .nauka-media { flex: 0 0 45%; max-width: 55%; background: #f3f4f6; display: flex; align-items: center; }
.nauka-list[data-view="rows"] .nauka-media > * { width: 100%; }
/* Szerokość filmu liczy study.js (fitRowVideo); film wypełnia całą wysokość karty. */
.nauka-list[data-view="rows"] .nauka-media[style*="width"] { flex: 0 0 auto; position: relative; }
.nauka-list[data-view="rows"] .nauka-media[style*="width"] video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.nauka-list[data-view="rows"] .nauka-body { flex: 1 1 auto; min-width: 0; }
.nauka-list[data-view="grid"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; gap: 1rem; }
.nauka-list[data-view="grid"] .nauka-card { height: 100%; }
/* Karuzela (Tinder): bieżące pytanie na środku, sąsiednie tylko fragmentami. */
.nauka-list[data-view="carousel"] { display: block; max-width: none; }
.nauka-carousel { position: relative; }
.car-stage { overflow: hidden; width: 100%; padding: 0.5rem 0; }
.car-track {
  position: relative; display: flex; align-items: stretch; gap: 1.5rem;
  width: max-content; will-change: transform;
}
.car-slot { width: min(640px, 80vw); display: flex; flex: 0 0 auto; cursor: pointer; }
.car-slot > .nauka-card { flex: 1 1 auto; height: auto; }
.car-nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 3.5rem; height: 3.5rem; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 9999px; background: var(--app-blue); color: #fff; cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.car-nav svg { width: 1.75rem; height: 1.75rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.car-nav:disabled { opacity: 0.35; cursor: default; }
.car-prev { left: 0.5rem; }
.car-next { right: 0.5rem; }
@media (max-width: 760px) {
  .car-track { gap: 0.75rem; }
  .car-nav { width: 2.75rem; height: 2.75rem; }
  .car-nav svg { width: 1.25rem; height: 1.25rem; }
}

.nauka-card {
  overflow: hidden; background: var(--color-neutral-primary, #fff);
  border: 1px solid var(--color-border-default, #e5e7eb); border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.nauka-media img, .nauka-media video { display: block; width: 100%; height: auto; }
.nauka-media img { aspect-ratio: 16 / 9; object-fit: cover; }
.nauka-media .media-placeholder { padding: 2rem 1rem; text-align: center; font-size: 0.85rem; color: #6b7280; background: #f3f4f6; }
.nauka-body { display: flex; flex-direction: column; padding: 1rem; }
.nauka-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.5rem; margin-bottom: 0.5rem; }
.nauka-num { font-size: 0.875rem; color: var(--color-heading, #1e1e1e); }
.nauka-num b { font-weight: 700; }
.nauka-seen { font-size: 0.75rem; font-weight: 500; color: #6b7280; }
/* Badge Preline (bg-surface / text-surface-foreground = gray-100 / gray-800).
   Zapas do czasu przebudowy app.css (tokeny dodane w src/app.css). */
.gap-x-1\.5 { column-gap: 0.375rem; }
.bg-surface { background-color: var(--color-surface, var(--color-gray-100, #f3f4f6)); }
.text-surface-foreground { color: var(--color-surface-foreground, var(--color-gray-800, #1f2937)); }
.nauka-mark {
  margin-left: auto; height: 1.75rem; padding: 0 0.75rem; font-size: 0.75rem; font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center;
  color: var(--app-blue); background: #fff; border: 1px solid var(--app-blue); border-radius: 0.375rem; cursor: pointer;
}
.nauka-mark:hover { background: #eff6ff; }
.nauka-mark.active { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.nauka-q { font-size: 1.5rem; font-weight: 400; line-height: 1.2; color: var(--color-heading, #1e1e1e); margin-bottom: 1rem; }
.nauka-lbl { font-size: 0.875rem; font-weight: 700; color: var(--color-heading, #1e1e1e); margin-bottom: 0.5rem; }
.nauka-answers { display: flex; flex-direction: column; gap: 0.4rem; }
.nauka-answers .answer-btn {
  padding: 0.55rem 0.8rem; font-size: 0.9rem; text-align: left; line-height: 1.3;
  color: var(--color-heading, #111827); background: #fff; border: 1px solid #d1d5db; border-radius: 0.5rem; cursor: pointer;
}
.nauka-answers .answer-btn:hover:not(:disabled) { border-color: var(--app-blue); }
.nauka-answers .answer-btn:disabled { cursor: default; }
.nauka-answers .answer-btn.is-correct { background: var(--app-green); border-color: var(--app-green); color: #fff; }
.nauka-answers .answer-btn.is-wrong { background: var(--app-red); border-color: var(--app-red); color: #fff; }
.nauka-answers.answers-yn { flex-direction: row; }
.nauka-answers.answers-yn .answer-btn { flex: 1; text-align: center; font-weight: 600; }
.nauka-answers { margin-bottom: 1rem; }
.nauka-explain { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-bottom: 1rem; font-size: 0.9rem; color: var(--color-body, #4b5563); }
.nauka-explain .btn-ai { min-height: 2.75rem; padding: 0 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.nauka-note { width: 100%; font-size: 0.85rem; }
.nauka-note summary { cursor: pointer; color: var(--app-blue); }
.nauka-note textarea {
  margin-top: 0.4rem; width: 100%; min-height: 4rem; padding: 0.5rem; font-size: 0.85rem;
  border: 1px solid var(--color-border-default, #d1d5db); border-radius: 0.5rem;
}
.nauka-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0 2rem; color: var(--color-body, #4b5563); }
.nauka-list[data-view="grid"] .nauka-q { font-size: 1.125rem; }
@media (max-width: 760px) {
  .nauka-list[data-view="grid"] { grid-template-columns: 1fr; }
  .nauka-list[data-view="rows"] .nauka-card { flex-direction: column; }
  .nauka-list[data-view="rows"] .nauka-media { flex: none; max-width: none; }
  .nauka-extra { flex-wrap: wrap; }
  .nauka-q { font-size: 1.25rem; }
}

/* Poprawna odpowiedź z bazy po udzieleniu odpowiedzi (Tak = zielony, Nie = czerwony) */
.nauka-correct-pill {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-start;
  min-width: 7.75rem; height: 2.75rem; padding: 0 1rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500; color: #fff;
}
.nauka-correct-pill.is-yes { background: var(--app-green); }
.nauka-correct-pill.is-no { background: var(--app-red); }
.nauka-verdict { font-size: 0.85rem; color: var(--color-body, #4b5563); }
.nauka-verdict.is-right { color: var(--app-green-dark); font-weight: 600; }
.nauka-verdict.is-wrong { color: var(--app-red-dark); }

/* ---- Mapa aktywności (Start): wiersze = tygodnie, kolumny = dni tygodnia, jasność = minuty ---- */
.dash-heat { min-width: 0; }
.dash-heat-sub { font-size: 0.875rem; color: var(--color-body, #4b5563); }
.heat { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.heat-row { display: grid; grid-template-columns: 3rem repeat(7, minmax(1.25rem, 1fr)); gap: 4px; align-items: center; }
.heat-head span { font-size: 0.7rem; font-weight: 600; text-align: center; color: var(--color-body, #6b7280); }
.heat-week { font-size: 0.7rem; color: var(--color-body, #6b7280); white-space: nowrap; }
.heat-cell { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 4px; background: #f1f5f9; }
.heat-l1 { background: var(--color-fg-brand, #1e40af); opacity: 0.25; }
.heat-l2 { background: var(--color-fg-brand, #1e40af); opacity: 0.5; }
.heat-l3 { background: var(--color-fg-brand, #1e40af); opacity: 0.75; }
.heat-l4 { background: var(--color-fg-brand, #1e40af); opacity: 1; }
.heat-future { visibility: hidden; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 0.7rem; color: var(--color-body, #6b7280); }
.heat-legend .heat-cell { width: 0.9rem; aspect-ratio: auto; height: 0.9rem; }
.heat-legend span { margin: 0 0.25rem; }

.pass-chance-note { margin-top: 0.5rem; font-size: 0.875rem; color: var(--color-body, #6b7280); }

/* ---- Następny krok (Start, Postępy) ---- */
.next-step {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  margin: 1rem 0 0; padding: 0.875rem 1rem; border-radius: 16px; background: #eff6ff; border: 1px solid #dbeafe;
}
.next-step p { flex: 1 1 18rem; margin: 0; font-size: 1rem; color: #1e1e1e; }
.next-step-tag {
  flex: none; padding: 0.125rem 0.5rem; border-radius: 999px; background: var(--app-blue); color: #fff;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.next-step .dash-btn { flex: none; }
.stats-cards .next-step { margin: 0.25rem 0 0.75rem; background: #fff; }

/* Postępy: jeden rząd liczb — 4 wskaźniki (Gotowość, Opanowanych, Wyświetlonych, Zdane) + kolumna z licznikami. */
.start-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .start-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.start-counts { display: grid; grid-template-rows: 1fr 1fr; gap: 0.5rem; }
.stats-kpis .start-counts .dash-count { min-height: 0; padding: 0.4rem 0.5rem; }
.stats-kpis .start-counts .dash-count strong { font-size: 1.25rem; }
.stats-kpis .start-counts .dash-count span { font-size: 0.85rem; }
@media (max-width: 900px) {
  .start-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Start: najczęściej mylone znaki. */
.dash-signs { margin-top: 1rem; }
.dash-signs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.dash-signs-head h2 { margin: 0; }

/* Postępy: gotowość rozpisana na warunki. */
.ready-card { gap: 0.75rem; }
.ready-sub { margin: 0; font-size: 0.875rem !important; color: #6b7280 !important; }
.ready-row { display: grid; gap: 0.3rem; }
.ready-row-head { display: flex; align-items: baseline; gap: 0.5rem; }
.ready-label { flex: 1; font-weight: 600; }
.ready-val { font-size: 1.125rem; }
.ready-goal { color: #6b7280; font-size: 0.8rem; }
.ready-detail { color: #6b7280; font-size: 0.8rem; }
.ready-todo { margin: 0.25rem 0 0; padding-left: 1.1rem; list-style: disc; font-size: 0.9rem; color: #374151; }
.dash-signs .sign-weak { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 700px) { .dash-signs .sign-weak { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Start: Gotowość + Co teraz? w jednym kontenerze (styl do dopracowania). */
.ready-box { margin-top: 1rem; padding: 1rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; }
.ready-box .stats-cards { margin-bottom: 0; }
.ready-gauge { display: flex; justify-content: center; }
.ready-gauge .dash-gauge svg { max-width: 200px; }
.ready-box .dash-card > p { flex: none; }

/* ---- Start: Skuteczność i Szansa na zdanie (dwa kontenery z opisem) ---- */
.score-cards { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 0 0 1rem; }
@media (min-width: 768px) { .score-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.score-card { gap: 0.5rem; }
.score-label { font-size: 0.875rem; font-weight: 600; color: var(--color-body, #4b5563); text-transform: none; }
.score-num { font-size: 2.5rem; font-weight: 700; line-height: 1; color: var(--app-blue); }
.score-num-chance { color: var(--app-green); }
.score-card > p.score-desc { flex: 0 0 auto; font-size: 0.9rem; line-height: 1.5; color: var(--color-body, #4b5563); }
.score-bar { position: relative; height: 0.625rem; margin-top: 0.25rem; border-radius: 999px; background: #e5e7eb; }
.score-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--app-blue); }
.score-bar-chance .score-fill { background: var(--app-green); }
.score-mark { position: absolute; top: -0.25rem; bottom: -0.25rem; width: 2px; margin-left: -1px; background: #111827; }
.score-foot { font-size: 0.8rem; line-height: 1.45; color: var(--color-body, #6b7280); }
.stats-kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 640px; }

/* Start: Gotowość — wykres po lewej, paski po prawej. */
.ready-box { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; align-items: center; gap: 1.5rem; }
.ready-rows { display: grid; gap: 1rem; min-width: 0; }
.ready-box .ready-gauge .dash-gauge { border: 0; box-shadow: none; padding: 0; }
@media (max-width: 640px) { .ready-box { grid-template-columns: 1fr; gap: 1rem; } }

/* Kolory pasków Flowbite, których nie ma jeszcze w zbudowanym app.css (po `npm run build`
   Tailwind je wygeneruje sam — wtedy te reguły można usunąć). Kolory z motywu Flowbite. */
.bg-success { background-color: var(--color-success); }
.bg-warning { background-color: var(--color-warning, #f97316); }
.bg-danger  { background-color: var(--color-danger); }
.text-fg-warning { color: var(--color-fg-warning, #ea580c); }
.ready-box .ready-row { gap: 0; }
.ready-box .ready-detail { margin-top: 0.35rem; }

/* Start: Gotowość + Szansa na zdanie obok siebie. */
.score-cards-1 { grid-template-columns: 1fr !important; margin-top: 1rem; }

/* ---- Kiedy się uczysz: mała mapa w stylu "contributions" (kolumny = tygodnie) ---- */
.dash-heat { --cell: 13px; --gap: 3px; }
.heat2-head h2 { margin: 0; }
.heat2-head .dash-heat-sub { margin: 0.15rem 0 0; }
.heat2-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-top: 0.75rem; font-size: 0.9rem; }
.heat2-summary strong { font-weight: 600; color: var(--color-heading, #111827); }
.heat2-summary span { color: var(--color-body, #6b7280); }
.heat2-scroll { overflow-x: auto; padding-bottom: 2px; }
.heat2 {
  display: grid; grid-template-columns: auto max-content; grid-template-rows: auto auto;
  column-gap: 0.5rem; row-gap: 0.35rem; width: max-content; margin: 0 auto;
}
.heat2-months { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: var(--cell); gap: var(--gap); }
.heat2-months span { font-size: 0.7rem; line-height: 1; color: var(--color-body, #6b7280); white-space: nowrap; overflow: visible; }
.heat2-days { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(7, var(--cell)); gap: var(--gap); }
.heat2-days span { font-size: 0.7rem; line-height: var(--cell); color: var(--color-body, #6b7280); }
.heat2-grid {
  grid-column: 2; grid-row: 2; display: grid; grid-template-rows: repeat(7, var(--cell));
  grid-auto-flow: column; grid-auto-columns: var(--cell); gap: var(--gap);
}
.heat2-grid .heat-cell, .dash-heat .heat-legend .heat-cell { width: var(--cell); height: var(--cell); aspect-ratio: auto; border-radius: 3px; opacity: 1; }
/* Skala w podstawowym zielonym aplikacji (jaśniej = mniej, pełny kolor = najwięcej). */
.dash-heat .heat-l0 { background: #ebedf0; }
.dash-heat .heat-l1 { background: color-mix(in srgb, var(--app-green) 30%, #ebedf0); }
.dash-heat .heat-l2 { background: color-mix(in srgb, var(--app-green) 55%, #ebedf0); }
.dash-heat .heat-l3 { background: color-mix(in srgb, var(--app-green) 80%, #ebedf0); }
.dash-heat .heat-l4 { background: var(--app-green-dark); }
.dash-heat .heat-future { visibility: hidden; }
.heat2-note { margin: 0; font-size: 0.75rem; color: var(--color-body, #9ca3af); }

/* ---- Start: neumorphism tylko na kontenerach (boksach); środek boksów bez zmian. */
/* Zmienne wyglądu kart — źródło: Start; używane w całej aplikacji (blok „Wspólny wygląd” na końcu pliku). */
:root {
  --neu-bg: #ffffff;
  --neu-dark: #dfdedd;
  --neu-light: #ffffff;
  --neu-raised: 8px 8px 16px var(--neu-dark), -8px -8px 16px var(--neu-light);
  --neu-radius: 20px;
  --ui-gap: 1.5rem;
  --ui-card-border: 1px solid var(--color-default, #e5e7eb); /* kolor obramowań aplikacji (gray-200) */
}
/* Wygląd kart Startu jest teraz wspólny dla całej aplikacji — blok „Wspólny wygląd” na końcu pliku. */
.start-neu .stats-kpis, .start-neu .score-cards { gap: 1.5rem; }
.start-neu .stats-kpis { margin-bottom: 1.5rem; }
.start-neu > section.dash-card, .start-neu > .score-cards-1 { margin-top: 1.5rem; } /* tylko boksy na pełną szerokość, nie w siatce */

/* ---- Kiedy się uczysz: jeden miesiąc, dni na osi X ---- */
.heat3 { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: 4px; margin-top: 0.75rem; }
.heat3-day { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 0; }
.heat3-day .heat-cell { width: 100%; height: auto; aspect-ratio: 1 / 1; max-width: 28px; border-radius: 4px; }
.heat3-num { font-size: 0.65rem; line-height: 1; color: var(--color-body, #6b7280); font-variant-numeric: tabular-nums; }
.heat3-day.is-today .heat-cell { outline: 2px solid var(--app-blue); outline-offset: 1px; }
.heat3-day.is-today .heat3-num { color: var(--app-blue); font-weight: 700; }
.heat3-day.is-future .heat-cell { background: #f5f5f4; }
.heat3-day.is-future .heat3-num { opacity: 0.45; }
/* Na telefonie podpisy tylko co 5 dni (i dzisiaj), żeby się nie zlewały. */
@media (max-width: 640px) {
  .heat3 { gap: 2px; }
  .heat3-num:not(.is-key) { visibility: hidden; }
  .heat3-day.is-today .heat3-num { visibility: visible; }
}
/* Postępy: odstępy wokół mapy "Kiedy się uczysz". */
.score-cards + .dash-heat { margin-top: 1rem; }
.dash-heat + .stats-activity { margin-top: 1rem; }

/* Start: przycisk pod kafelkami (jak w innych boksach) + Najczęściej mylone pytania. */
.dash-box-foot { display: flex; justify-content: flex-end; margin-top: 0.25rem; }
.dash-signs > h2 { margin: 0 0 0.25rem; }
.q-weak-item { display: block; color: inherit; text-decoration: none; }
.q-weak-item:hover { text-decoration: none; }
.q-weak-item:hover figure { border-color: #93c5fd; }
.q-weak figure { height: 100%; text-align: left; }
.q-weak-media { height: 90px; margin-bottom: 0.4rem; border-radius: 0.35rem; overflow: hidden; background: #f3f4f6; display: grid; place-items: center; }
.q-weak-media img, .q-weak-media video { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.q-weak-noimg { font-size: 1.5rem; font-weight: 700; color: #9ca3af; }
.q-weak figcaption { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }

/* Start: badge "Sugerowana akcja" nad jednym z kafelków Nauka / Szybki test / Egzamin. */
.suggest-badge {
  position: absolute; top: 0; left: 1.25rem; transform: translateY(-50%);
  display: inline-flex; align-items: center; column-gap: 0.375rem;
  padding: 0.375rem 0.75rem; border-radius: 9999px; /* jak badge Preline: py-1.5 px-3 rounded-full */
  background: #fff; color: var(--app-blue); border: 2px solid var(--app-blue); /* outline */
  font-size: 0.75rem; font-weight: 500; line-height: 1rem; white-space: nowrap;
}
.dash-card.is-suggested:not(.dash-card-brand) { outline: 2px solid var(--app-blue); outline-offset: -2px; }
.dash-card-brand.is-suggested { outline: 2px solid var(--app-green); outline-offset: 2px; }

/* Postępy: Pytania do powtórki — uproszczona tabela z paginacją. */
.wtable-q { color: inherit; text-decoration: none; }
.wtable-q:hover { color: var(--app-blue); text-decoration: underline; }
.wtable-dots { display: inline-flex; gap: 4px; }
.wtable-dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #e5e7eb; }
.wtable-dots i.on { background: var(--app-green); }
.wtable-wrap tbody tr:last-child { border-bottom: 0; }
.wtable-pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.75rem; }
.wtable-pages { display: flex; align-items: center; gap: 0.5rem; }
.wtable-pages button {
  width: 2rem; height: 2rem; border: 1px solid #e5e7eb; border-radius: 0.5rem; background: #fff;
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--color-heading, #111827);
}
.wtable-pages button:hover:not(:disabled) { border-color: var(--app-blue); color: var(--app-blue); }
.wtable-pages button:disabled { opacity: 0.4; cursor: default; }
/* Telefon: każdy wiersz jako karta — pytanie na całą szerokość, pod nim jedna linijka danych. */
@media (max-width: 640px) {
  .wtable-wrap table, .wtable-wrap tbody { display: block; }
  .wtable-wrap thead { display: none; }
  .wtable-wrap tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; padding: 0.75rem 0.9rem; }
  .wtable-wrap tbody tr[hidden] { display: none; }
  .wtable-wrap tbody th { display: block; width: 100%; padding: 0 !important; }
  .wtable-wrap tbody td { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 !important; font-size: 0.8rem; }
  .wtable-wrap tbody td::before { content: attr(data-label) ":"; font-weight: 400; color: var(--color-body, #6b7280); }
  .wtable-wrap tbody td[data-label="Powtórka"]::before { content: none; }
  .wtable-toolbar { flex-direction: column; align-items: stretch; }
  #wtable-search { width: 100%; }
}

/* ------------------------------------------------------- Admin: konta */
.acc-table .chip { margin-right: 0.25rem; }
.acc-edit { color: var(--app-blue); font-weight: 500; text-decoration: none; }
.acc-edit:hover { text-decoration: underline; }
.acc-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--color-heading, #1f2937); }
.acc-danger { margin-top: 1.5rem; border-color: #fecaca; }
.acc-danger .btn-danger { margin-top: 0.75rem; background: var(--app-red); border-color: var(--app-red); color: #fff; }

/* ------------------------------------------------------- Admin: Zapytaj AI */
.aiq { display: flex; flex-direction: column; gap: 1rem; }
.aiq-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.aiq-student { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 500; }
.aiq-student .nauka-select { min-width: 18rem; }
.aiq-log { display: flex; flex-direction: column; gap: 0.75rem; min-height: 12rem; max-height: 60vh; overflow-y: auto;
  padding: 1rem; border: 1px solid var(--color-border-default, #e5e7eb); border-radius: 0.75rem; background: #f9fafb; }
.aiq-empty p { font-size: 0.875rem; color: #6b7280; margin-bottom: 0.5rem; }
.aiq-examples { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-btn { padding: 0.4rem 0.75rem; border: 1px solid #bfdbfe; border-radius: 9999px; background: #fff;
  color: var(--app-blue); font-size: 0.8rem; cursor: pointer; text-align: left; }
.chip-btn:hover { background: #eff6ff; }
.aiq-msg { max-width: 85%; padding: 0.75rem 1rem; border-radius: 0.75rem; font-size: 0.9rem; line-height: 1.5; }
.aiq-user { align-self: flex-end; background: var(--app-blue); color: #fff; }
.aiq-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--color-border-default, #e5e7eb); }
.aiq-assistant ul, .aiq-assistant ol { padding-left: 1.25rem; list-style: disc; }
.aiq-assistant ol { list-style: decimal; }
.aiq-assistant p + p, .aiq-assistant p + ul, .aiq-assistant ul + p { margin-top: 0.5rem; }
.aiq-typing { color: #6b7280; font-style: italic; }
.aiq-error { color: var(--app-red); }
.aiq-form { display: flex; gap: 0.75rem; align-items: flex-end; }
.aiq-form textarea { flex: 1; padding: 0.6rem 0.75rem; font-size: 0.9rem; border: 1px solid var(--color-border-default, #d1d5db);
  border-radius: 0.5rem; resize: vertical; }
@media (max-width: 640px) { .aiq-form { flex-direction: column; align-items: stretch; } .aiq-msg { max-width: 100%; } }

/* Podpowiedź AI na Start (2 linie). */
.dash-head .ai-hint p { margin-top: 0.4rem; }
.dash-head .ai-hint.is-ai p + p { margin-top: 0.15rem; }
.dash-head .ai-hint.is-ai .ai-hint-action { color: var(--app-blue); font-weight: 500; }

/* Wyjaśnienie AI: podstawa prawna (art. PoRD / § rozporządzenia o znakach). */
.ai-law { padding: 0.6rem 0.8rem; border-left: 3px solid var(--app-blue); background: #eff6ff; border-radius: 0.375rem;
  font-size: 0.875rem; color: var(--color-heading, #1f2937); }
.ai-law-label { font-weight: 600; color: var(--app-blue); }
.ai-law-text { margin-top: 0.35rem; }
.ai-law-text summary { cursor: pointer; font-size: 0.8rem; color: var(--app-blue); }
.ai-law-text pre { margin-top: 0.4rem; white-space: pre-wrap; font-family: inherit; font-size: 0.8rem; line-height: 1.45;
  color: var(--color-body, #4b5563); max-height: 16rem; overflow-y: auto; }

/* Logo aplikacji (static/img/app-logo.svg) w menu, nagłówku mobilnym i na logowaniu.
   Ikona (static/img/app-icon.png) = favicon i ikony PWA w static/img/icons/. */
.app-logo { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; }
.app-brand { display: inline-flex; align-items: center; gap: 8px; }
.app-brand .app-logo { width: 28px; height: 28px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.auth-brand img { width: 56px; height: 56px; }
.dash-head .ai-hint.is-ai { max-width: 75ch; font-size: 1rem; color: var(--color-body, #4b5563); line-height: 1.55; }
.dash-head .ai-hint.is-ai ul { margin: 0.4rem 0; padding-left: 1.25rem; list-style: disc; }
.dash-head .ai-hint.is-ai li + li { margin-top: 0.2rem; }
.dash-head .ai-hint.is-ai strong { color: var(--color-heading, #1f2937); }

/* ------------------------------------------------------- Diagnostyka (admin, Start) — alert Preline */
.diag-box { display: flex; flex-direction: column; gap: 0.75rem; margin: 0 0 1.25rem; }
.diag-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.diag-alert .flex { align-items: flex-start; }
.diag-alert .mt-0\.5 { margin-top: 0.125rem; }
.diag-alert .ms-4 { margin-inline-start: 1rem; }
.diag-alert .space-y-1 > * + * { margin-top: 0.25rem; }
.diag-body { flex: 1; min-width: 0; }
.diag-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.diag-error .diag-text { color: #991b1b; }
.diag-warn { background: #fefce8; border-color: #fef08a; color: #854d0e; }
.diag-warn .diag-text { color: #854d0e; }
.diag-ok { background: #f0fdfa; border-color: #99f6e4; color: #115e59; }
.diag-ok .diag-text { color: #115e59; }
.diag-loading { background: #f9fafb; border-color: #e5e7eb; color: #6b7280; }
.diag-ok summary { cursor: pointer; }
.diag-refresh { margin-left: 0.75rem; flex-shrink: 0; font-size: 0.75rem; font-weight: 500; color: inherit;
  background: transparent; border: 1px solid currentColor; border-radius: 0.375rem; padding: 0.2rem 0.5rem; cursor: pointer; opacity: 0.8; }
.diag-refresh:hover { opacity: 1; }
.diag-stack .diag-alert + .diag-alert .diag-refresh { display: none; }  /* jeden przycisk wystarczy */
@media (prefers-color-scheme: dark) {
  .dark .diag-error { background: rgb(239 68 68 / 0.2); border-color: #7f1d1d; color: #f87171; }
}

/* Podpowiedź AI na Start: powitanie <h1>, pierwsze zdanie <h2>, kolejne <h3>. */
.dash-head .ai-hint.is-ai h2 { margin-top: 0.35rem; font-size: 1.25rem; font-weight: 600; line-height: 1.35;
  color: var(--color-heading, #1f2937); }
.dash-head .ai-hint.is-ai h3 { margin-top: 0.2rem; font-size: 1rem; font-weight: 500; line-height: 1.45;
  color: var(--color-body, #4b5563); }


/* =====================================================================
   Wspólny wygląd całej aplikacji — źródło prawdy: zakładka Start.
   Karty: białe, bez obramowania, zaokrąglenie 20 px, miękki cień (neumorphism);
   nagłówki stron: .dash-head (jak „Witaj …”); odstępy 1.5 rem; przyciski i zakładki
   w kolorze akcentu (niebieski). Nowe ekrany: używaj .panel / .dash-card + .dash-head.
   ===================================================================== */
.panel,
.dash-card,
.ready-box,
.dash-kpi,
.nauka-card,
.nauka-toolbar,
.fc-card,
.sign-tile,
.auth-card,
.exam-shell .exam-main,
.exam-shell .exam-aside,
.sign-question {
  /* Bez !important: ta reguła jest na końcu pliku, więc i tak wygrywa z Tailwindem i starszymi stylami. */
  border: var(--ui-card-border);
  background: var(--neu-bg);
  border-radius: var(--neu-radius);
  box-shadow: var(--neu-raised);
}
/* Karta Egzamin (granatowa): obramowanie w kolorze tła — ten sam rozmiar karty, bez jasnej ramki. */
.dash-card-brand { background: var(--color-fg-brand); border-color: var(--color-fg-brand); }
.panel { margin-bottom: var(--ui-gap); padding: 1.5rem; }
.panel h2 { font-size: 1.25rem; font-weight: 700; color: var(--color-heading, #111827); }
.sign-tile .rounded-t-base { border-radius: var(--neu-radius) var(--neu-radius) 0 0; }
.nauka-card { overflow: hidden; }
.nauka-list { gap: var(--ui-gap); }
.nauka-list[data-view="grid"] { gap: var(--ui-gap); }
.nauka-toolbar { margin-bottom: var(--ui-gap); }
.panels-2, .panels-3 { gap: var(--ui-gap); }
.stats-kpis { gap: var(--ui-gap); }

/* Nagłówek każdej strony = nagłówek Startu. */
.dash-head { margin: 0.5rem 0 var(--ui-gap); }
.dash-head p { max-width: 75ch; }

/* Przyciski .btn jak przyciski Startu (.dash-btn): obrys w kolorze akcentu, jasnoniebieskie tło po najechaniu. */
.btn { border-radius: 0.5rem; border-color: var(--app-blue); color: var(--app-blue-dark); }
.btn:hover { background: #eff6ff; color: var(--app-blue-dark); }
.btn-primary { border-radius: 0.5rem; background: var(--app-blue); color: #fff; }
.btn-primary:hover { background: var(--app-blue-dark); color: #fff; }

/* Zakładki i przełączniki: aktywna w kolorze akcentu. */
.stats-tabs button.is-active,
.wtable-tabs button.is-active { color: var(--app-blue-dark); border-bottom-color: var(--app-blue); }
.quiz-modes a { background: #fff; }
.quiz-modes a:hover { border-color: var(--app-blue); }

/* Test / egzamin i Quiz znaków: pytanie i panel boczny w kartach jak na Starcie. */
.exam-shell .exam-main, .exam-shell .exam-aside { padding: 1.25rem; }
.exam-shell #exam-grid { gap: var(--ui-gap); }
.exam-shell .exam-aside { width: 288px; }
.sign-question { padding: 1.5rem; }
@media (max-width: 640px) {
  .stats-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 1rem; scrollbar-width: none; }
  .stats-tabs::-webkit-scrollbar { display: none; }
  .stats-tabs button { white-space: nowrap; flex-shrink: 0; }
}

/* Znaki drogowe i fiszki: układ wierszy — klasy Tailwind w signs.html / flashcards.html. */

/* ------------------------------------------------------- Mój profil (układ: klasy Tailwind w profile.html) */
.profile-avatar { position: relative; width: 112px; height: 112px; border-radius: 9999px; border: 0; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; overflow: visible;
  background: #eff6ff; color: var(--app-blue-dark); font-size: 2.75rem; font-weight: 700; }
.profile-avatar:hover { box-shadow: 0 0 0 4px #bfdbfe; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 9999px; }
.profile-avatar-edit { position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--app-blue); color: #fff;
  border: 3px solid #fff; }
.google-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.google-btn:disabled:hover { background: #fff; border-color: #d1d5db; }


/* --- Przywrócone (wycięte przypadkiem w 445b652) --------------------------------------------- */
/* Kolorowe przyciski (fiszki Znam / Nie znam, Usuń konto) — ważniejsze niż ogólny .btn.
   Kolory jak w całej aplikacji: poprawna = --app-green, błędna = --app-red; obrys = tło, tekst biały. */
.btn.fc-btn-known,
.btn.fc-btn-known:focus { background: var(--app-green); border-color: var(--app-green); color: #fff; }
.btn.fc-btn-known:hover { background: var(--app-green-dark); border-color: var(--app-green-dark); color: #fff; }
.btn.fc-btn-unknown,
.btn.fc-btn-unknown:focus,
.btn.btn-danger,
.btn.btn-danger:focus { background: var(--app-red); border-color: var(--app-red); color: #fff; }
.btn.fc-btn-unknown:hover,
.btn.btn-danger:hover { background: var(--app-red-dark); border-color: var(--app-red-dark); color: #fff; }
.btn.fc-btn-known { --tw-ring-color: color-mix(in srgb, var(--app-green) 40%, transparent); }
.btn.fc-btn-unknown, .btn.btn-danger { --tw-ring-color: color-mix(in srgb, var(--app-red) 40%, transparent); }
/* Przycisk Google: układ jak oficjalny (logo G + tekst), kolory i zaokrąglenia jak w aplikacji. */
.google-btn { display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1.25rem; border-radius: 0.5rem;
  border: 1px solid #d1d5db; background: #fff; color: var(--color-heading, #1f2937); font-size: 0.95rem; font-weight: 500;
  text-decoration: none; cursor: pointer; }
.google-btn:hover { background: var(--color-neutral-secondary, #f9fafb); border-color: var(--app-blue); text-decoration: none;
  color: var(--color-heading, #1f2937); }
.google-btn .google-g { width: 20px; height: 20px; flex-shrink: 0; }
/* Admin → Nowe konto: karta na pełną szerokość, sam formularz węższy. */
.acc-new form { max-width: 640px; }

} /* @layer components */
