/* =========================================================
   ELM05.online — style aplikacji
   ========================================================= */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-50: #eff6ff;

  --green: #059669;
  --green-50: #ecfdf5;
  --amber: #d97706;
  --amber-50: #fffbeb;
  --red: #dc2626;
  --red-50: #fef2f2;
  --violet: #7c3aed;
  --violet-50: #f5f3ff;
  --rose: #e11d48;
  --rose-50: #fff1f2;
  --slate: #475569;
  --slate-50: #f1f5f9;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px -18px rgba(15, 23, 42, 0.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small-note {
  font-size: 12px;
  line-height: 1.45;
}

.center {
  text-align: center;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =========================================================
   Przyciski i drobne elementy
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 15px;
  font-weight: 650;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn.small {
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.8);
}

.btn.primary:hover {
  background: var(--brand-600);
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.btn.danger {
  background: var(--red);
  color: #fff;
}

.btn.danger:hover {
  background: #b91c1c;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  padding: 0;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.icon-btn.danger:hover {
  background: var(--red-50);
  color: var(--red);
  border-color: #fecaca;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-actions {
  display: flex;
  gap: 2px;
}

.row-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.pill-green {
  background: var(--green-50);
  color: var(--green);
}

.pill-amber {
  background: var(--amber-50);
  color: var(--amber);
}

.pill-red {
  background: var(--red-50);
  color: var(--red);
}

.pill-blue {
  background: var(--brand-50);
  color: var(--brand-600);
}

.pill-violet {
  background: var(--violet-50);
  color: var(--violet);
}

.pill-slate {
  background: var(--slate-50);
  color: var(--slate);
}

.code-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 7px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.5;
  white-space: nowrap;
}

.tone-blue {
  background: var(--brand-50);
  color: var(--brand-600);
}

.tone-violet {
  background: var(--violet-50);
  color: var(--violet);
}

.tone-amber {
  background: var(--amber-50);
  color: var(--amber);
}

.tone-green {
  background: var(--green-50);
  color: var(--green);
}

.tone-rose {
  background: var(--rose-50);
  color: var(--rose);
}

.tone-slate {
  background: var(--slate-50);
  color: var(--slate);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  color: #0f766e;
  font-weight: 800;
  font-size: 12px;
  flex: none;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 10.5px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #dbeafe;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex: none;
}

.spinner.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

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

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 70px 20px;
}

/* =========================================================
   Topbar
   ========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #0ea5a4);
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(37, 99, 235, 0.7);
  flex: none;
}

.brand-name {
  font-size: 18px;
  white-space: nowrap;
}

.brand-name span {
  color: var(--brand);
}

.main-nav {
  display: flex;
  gap: 3px;
  margin-left: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 650;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-link.active {
  background: var(--brand-50);
  color: var(--brand-600);
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  max-width: 160px;
}

.user-chip-text strong {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-text small {
  font-size: 10.5px;
  color: var(--muted);
}

.view {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 24px 70px;
}

/* =========================================================
   Nagłówki stron, karty, statystyki
   ========================================================= */

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 3px 0 7px;
}

.page-head p {
  color: var(--muted);
  margin: 0;
  max-width: 72ch;
  font-size: 14px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--brand);
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.head-with-back {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 19px;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-head p {
  color: var(--muted);
  margin: 2px 0 0;
  font-size: 12.5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex: none;
}

.stat-card strong {
  display: block;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #fcfdff;
}

td code,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 5px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 160px;
}

.user-cell > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.user-cell strong {
  font-size: 13px;
}

.user-cell small {
  font-size: 10.5px;
  color: var(--muted);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid;
}

.alert.error {
  background: var(--red-50);
  border-color: #fecaca;
  color: #991b1b;
}

.alert.success {
  background: var(--green-50);
  border-color: #a7f3d0;
  color: #065f46;
}

.alert strong {
  display: block;
  font-size: 12.5px;
}

.alert span {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 46px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  gap: 6px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--brand-50);
  color: var(--brand);
  margin-bottom: 5px;
}

.empty h3 {
  margin: 0;
  font-size: 16px;
}

.empty p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  max-width: 52ch;
}

/* =========================================================
   Egzaminy — karty
   ========================================================= */

.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.exam-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.exam-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 14px 30px -18px rgba(37, 99, 235, 0.35);
}

.exam-card h3 {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.exam-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.exam-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.exam-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.exam-card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 7px;
}

.exam-date {
  font-size: 10.5px;
  color: #94a3b8;
}

.student-exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.student-exam-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.student-exam-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #2563eb, #0ea5a4);
}

.student-exam-card.is-done::before {
  background: linear-gradient(180deg, #059669, #34d399);
}

.student-exam-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.student-exam-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.student-exam-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.student-exam-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.grade-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--green-50);
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 12.5px;
}

.grade-box strong {
  font-size: 13px;
}

/* =========================================================
   Formularze
   ========================================================= */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.field label {
  font-size: 11.5px;
  font-weight: 750;
  color: #334155;
}

.field-narrow {
  max-width: 145px;
  flex: 0 0 145px;
}

.field-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-size: 13.5px;
}

textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

.input-with-button {
  position: relative;
  display: flex;
}

.input-with-button input {
  padding-right: 44px;
}

.input-icon-btn {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.input-icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.check-row input {
  width: auto;
  accent-color: var(--brand);
}

.table-config {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.table-config .form-row {
  margin-bottom: 6px;
}

.confirm-text {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

/* =========================================================
   Modal
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  opacity: 0;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

.modal-overlay.open {
  opacity: 1;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.5);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.18s ease;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  margin-bottom: 5vh;
}

.modal-overlay.open .modal {
  transform: none;
}

.modal-sm {
  max-width: 430px;
}

.modal-lg {
  max-width: 760px;
}

.modal-xl {
  max-width: 1040px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.modal-head h3 {
  margin: 0;
  font-size: 16.5px;
  letter-spacing: -0.015em;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
  flex: none;
}

.lightbox {
  display: flex;
  justify-content: center;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px;
}

.lightbox img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
}

/* =========================================================
   Toasty
   ========================================================= */

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 11px 14px;
  border-radius: 11px;
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, 0.65);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-success svg {
  color: #34d399;
}

.toast-error svg {
  color: #f87171;
}

.toast-info svg {
  color: #60a5fa;
}

/* =========================================================
   Login
   ========================================================= */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #fff;
}

.login-visual {
  position: relative;
  padding: 42px clamp(28px, 5vw, 72px) 32px;
  background:
    radial-gradient(circle at 15% 12%, rgba(37, 99, 235, 0.32), transparent 42%),
    radial-gradient(circle at 90% 80%, rgba(14, 165, 164, 0.2), transparent 45%),
    linear-gradient(150deg, #0b1220 0%, #0f1e3d 55%, #10312f 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 60% 40%, #000 10%, transparent 70%);
  pointer-events: none;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.login-brand .brand-mark {
  box-shadow: 0 8px 22px -8px rgba(14, 165, 164, 0.9);
}

.login-brand .brand-name {
  color: #f8fafc;
  font-size: 19px;
}

.login-brand .brand-name span {
  color: #7dd3fc;
}

.login-hero {
  margin-top: auto;
  padding-top: 54px;
  position: relative;
  z-index: 1;
}

.login-hero .eyebrow {
  color: #7dd3fc;
}

.login-hero h1 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  margin: 12px 0 18px;
  color: #fff;
  font-weight: 800;
}

.login-hero h1 span {
  color: #7dd3fc;
}

.login-hero p {
  color: #a7b6cc;
  font-size: 15.5px;
  line-height: 1.6;
  max-width: 48ch;
  margin: 0;
}

.login-features {
  list-style: none;
  padding: 0;
  margin: 30px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.login-features li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.login-features li > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(125, 211, 252, 0.11);
  border: 1px solid rgba(125, 211, 252, 0.18);
  color: #7dd3fc;
  flex: none;
}

.login-features strong {
  display: block;
  font-size: 13.5px;
  color: #e2e8f0;
  line-height: 1.3;
}

.login-features small {
  display: block;
  color: #8fa2ba;
  font-size: 12px;
  line-height: 1.4;
}

.login-art {
  position: absolute;
  right: -50px;
  bottom: 90px;
  width: 340px;
  height: 240px;
  z-index: 0;
  opacity: 0.55;
  transform: rotate(-8deg);
}

.art-card {
  position: absolute;
  width: 210px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.art-card-1 {
  top: 0;
  left: 0;
}

.art-card-2 {
  top: 70px;
  right: 0;
}

.art-card-3 {
  bottom: 0;
  left: 45px;
}

.art-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}

.art-dot.blue {
  background: #60a5fa;
}

.art-dot.green {
  background: #34d399;
}

.art-dot.violet {
  background: #a78bfa;
}

.art-line {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.25);
}

.art-line.w70 {
  width: 70%;
}

.art-line.w45 {
  width: 45%;
}

.art-line.w60 {
  width: 60%;
}

.art-line.w80 {
  width: 80%;
}

.art-line.w35 {
  width: 35%;
}

.art-line.w50 {
  width: 50%;
}

.login-footnote {
  margin: auto 0 0;
  padding-top: 40px;
  font-size: 11px;
  color: #6b7f98;
  position: relative;
  z-index: 1;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(180deg, #f8fafc, #ffffff 45%);
}

.login-card {
  width: 100%;
  max-width: 468px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 28px 70px -34px rgba(15, 23, 42, 0.35);
}

.login-card-head {
  margin-bottom: 20px;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 750;
  margin-bottom: 12px;
}

.login-card-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.035em;
}

.login-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-card .field {
  margin-bottom: 13px;
}

.login-submit {
  margin-top: 4px;
  padding: 11px 16px;
  font-size: 14.5px;
}

.form-error {
  background: var(--red-50);
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.demo-accounts {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.demo-accounts > p {
  margin: 0 0 9px;
  font-size: 11px;
  color: var(--muted);
}

.demo-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-account {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.demo-account:hover {
  border-color: #bfdbfe;
  background: var(--brand-50);
}

.demo-role {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand-600);
  background: #dbeafe;
  padding: 2px 6px;
  border-radius: 5px;
}

.demo-account strong {
  font-size: 12px;
  line-height: 1.2;
}

.demo-account small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

.demo-account code {
  font-size: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

/* =========================================================
   Builder egzaminu
   ========================================================= */

.builder-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fade-in 0.25s ease;
}

.builder-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.builder-title {
  flex: 1;
  min-width: 240px;
}

.builder-title-line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.builder-title h1 {
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 5px 0 0;
}

.builder-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 15px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.builder-tree {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 150px);
  position: sticky;
  top: 80px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.panel-head.mini {
  padding: 10px 14px;
  background: #fbfdff;
}

.panel-head.mini h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.tree-body {
  overflow-y: auto;
  padding: 7px;
  flex: 1;
  min-height: 120px;
}

.tree-node {
  position: relative;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  padding-left: calc(7px + var(--depth) * 13px);
  border-radius: 8px;
  transition: background 0.12s ease;
}

.tree-row:hover {
  background: #f8fafc;
}

.tree-type {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  flex: none;
}

.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.tree-name {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-sub {
  font-size: 10px;
  color: var(--muted);
}

.tree-actions {
  display: none;
  gap: 0;
  flex: none;
}

.tree-row:hover .tree-actions {
  display: flex;
}

.tree-actions .icon-btn {
  width: 25px;
  height: 25px;
  border-radius: 6px;
}

.tree-children {
  border-left: 1px dashed #e2e8f0;
  margin-left: 17px;
}

.pdf-section {
  border-top: 1px solid var(--line);
  padding-bottom: 7px;
  flex: none;
}

.pdf-list {
  padding: 5px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 175px;
  overflow-y: auto;
}

.pdf-item {
  display: flex;
  align-items: center;
  gap: 1px;
  border-radius: 8px;
}

.pdf-item.active {
  background: var(--brand-50);
}

.pdf-item-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  color: var(--ink);
}

.pdf-item-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #475569;
  flex: none;
}

.pdf-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.pdf-item-text strong {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.pdf-item-text small {
  font-size: 10px;
  color: var(--muted);
}

.pdf-item .icon-btn {
  width: 27px;
  height: 27px;
}

.builder-pdf {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  min-width: 0;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex: none;
}

.pdf-select {
  max-width: 250px;
  padding: 7px 9px;
  font-size: 12px;
}

.pdf-nav,
.pdf-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pdf-nav {
  margin-left: auto;
}

.page-label {
  font-size: 11.5px;
  color: var(--muted);
  min-width: 62px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pdf-help {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 15px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  border-bottom: 1px solid #dbeafe;
  flex: none;
}

.pdf-help > svg {
  margin-top: 1px;
  color: var(--brand);
}

.pdf-help strong {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}

.pdf-help span {
  display: block;
  color: #3b82f6;
  font-size: 11px;
  line-height: 1.35;
}

.pdf-stage {
  padding: 22px;
  background: #eef2f7;
  background-image: radial-gradient(#cbd5e1 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  overflow: auto;
  flex: 1;
  min-height: 520px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pdf-stage > .empty,
.pdf-stage > .alert,
.pdf-stage > .loading {
  margin: auto;
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.8);
}

.pdf-canvas-wrap {
  position: relative;
  background: #fff;
  box-shadow: 0 14px 40px -14px rgba(15, 23, 42, 0.45);
  flex: none;
}

.pdf-canvas-wrap canvas {
  display: block;
}

.pdf-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.pdf-stage.is-busy .pdf-overlay {
  cursor: wait;
}

.selection-box {
  position: absolute;
  border: 2px solid var(--brand);
  background: rgba(37, 99, 235, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

.crop-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crop-preview img {
  max-height: 190px;
  max-width: 100%;
  object-fit: contain;
  align-self: center;
  border-radius: 6px;
  background: #fff;
}

.crop-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.crop-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* =========================================================
   Uczeń — rozwiązywanie egzaminu
   ========================================================= */

.runner-page {
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: fade-in 0.25s ease;
}

.runner-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.runner-head-left {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.runner-code {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.runner-head h1 {
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 5px 0 0;
}

.runner-head-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.runner-progress {
  width: 230px;
  min-width: 160px;
}

.runner-grid {
  display: grid;
  grid-template-columns: minmax(265px, 330px) minmax(0, 1fr);
  gap: 15px;
  align-items: start;
}

.runner-tree {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 105px);
  display: flex;
  flex-direction: column;
}

.student-tree {
  overflow-y: auto;
  padding: 7px;
}

.student-group {
  margin-bottom: 1px;
}

.student-group summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
  font-size: 12.5px;
  color: #334155;
}

.student-group summary::-webkit-details-marker {
  display: none;
}

.student-group summary:hover {
  background: #f8fafc;
}

.student-group-icon {
  color: #64748b;
  display: flex;
}

.student-group-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  font-size: 10px;
  color: var(--muted);
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.student-children {
  padding-left: 10px;
  border-left: 1px dashed #e2e8f0;
  margin-left: 15px;
}

.student-leaf {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: #475569;
  transition: background 0.12s ease, color 0.12s ease;
}

.student-leaf:hover {
  background: #f8fafc;
}

.student-leaf.active {
  background: var(--brand-50);
  color: var(--brand-700);
}

.leaf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
  flex: none;
}

.student-leaf.answered .leaf-dot {
  background: var(--green);
}

.leaf-icon {
  display: flex;
  flex: none;
}

.leaf-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaf-status {
  color: var(--green);
  display: flex;
  flex: none;
}

.runner-part {
  min-height: 540px;
  min-width: 0;
}

.part-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.part-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.part-title-wrap h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.part-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.part-counter {
  font-size: 11.5px;
  color: var(--muted);
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.part-figure {
  margin: 16px 22px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.part-figure img {
  max-height: 430px;
  max-width: 100%;
  object-fit: contain;
  align-self: center;
  padding: 12px;
  cursor: zoom-in;
}

.part-figure figcaption {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.part-instructions,
.part-content {
  margin: 16px 22px 0;
  padding: 12px 15px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.part-instructions strong,
.part-content strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
}

.part-instructions p,
.part-content p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.6;
}

.answer-area {
  padding: 18px 22px 8px;
}

.answer-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.answer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 750;
  font-size: 12.5px;
}

.answer-textarea {
  min-height: 210px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.65;
}

.answer-textarea.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #fbfdff;
}

.fill-table {
  background: #fff;
}

.fill-table th,
.fill-table td {
  padding: 6px;
  border: 1px solid var(--line);
}

.fill-table th {
  background: #f8fafc;
  font-size: 10px;
}

.fill-table input {
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  min-width: 80px;
  border-color: #e2e8f0;
}

.part-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
  flex-wrap: wrap;
  margin-top: 12px;
}

.part-foot-nav {
  display: flex;
  gap: 7px;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.save-status.saving {
  color: var(--amber);
}

.save-status.error {
  color: var(--red);
}

.save-status.saved {
  color: var(--green);
}

.teacher-comment {
  margin: 16px 22px 0;
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--violet-50);
  border: 1px solid #ddd6fe;
  color: #5b21b6;
  font-size: 12.5px;
}

.teacher-comment strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

/* =========================================================
   Rysowanie
   ========================================================= */

.drawing {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.drawing-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  flex-wrap: wrap;
}

.swatches {
  display: flex;
  gap: 5px;
  align-items: center;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.active {
  box-shadow: 0 0 0 2px var(--brand);
}

.swatch-eraser {
  display: grid;
  place-items: center;
  background: #fff;
  color: #64748b;
}

.range-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}

.range-label input {
  width: 96px;
  padding: 0;
  border: 0;
  accent-color: var(--brand);
}

.drawing-actions {
  margin-left: auto;
  display: flex;
  gap: 1px;
}

.canvas-wrap {
  position: relative;
  background: #fff;
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.canvas-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11.5px;
  color: #94a3b8;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.86);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed #cbd5e1;
}

.canvas-hint.hidden {
  display: none;
}

.drawing-note {
  margin: 0;
  padding: 6px 10px;
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.drawing.is-disabled .drawing-toolbar {
  opacity: 0.5;
  pointer-events: none;
}

.drawing.is-disabled .canvas-wrap canvas {
  cursor: default;
}

/* =========================================================
   Nauczyciel — przegląd odpowiedzi
   ========================================================= */

.review-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.review-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.review-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 15px 18px;
}

.review-card-title {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.review-card-title h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.review-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  align-items: center;
}

.review-card > .progress-wrap {
  padding: 0 18px 14px;
}

.review-body {
  border-top: 1px solid var(--line);
  padding: 16px 18px;
  background: #fcfdff;
}

.review-overall {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.review-overall-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.review-parts {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.review-group h4 {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 9px 0;
  font-size: 12.5px;
  color: #334155;
}

.review-part {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.review-part-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.review-part-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.review-part-head strong {
  font-size: 13px;
}

.review-instructions {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.review-reference {
  max-height: 150px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 5px 0;
  cursor: zoom-in;
  display: block;
  background: #f8fafc;
}

.review-answer {
  margin-top: 6px;
}

.answer-text {
  white-space: pre-wrap;
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  line-height: 1.55;
}

.answer-image {
  max-width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
  margin-top: 8px;
  background: #fff;
}

.no-answer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px;
}

.grade-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.input-small {
  width: 88px;
  flex: none;
  padding: 7px 9px;
}

.input-comment {
  flex: 1;
  min-width: 150px;
  padding: 7px 9px;
}

.readonly-table {
  font-size: 12px;
}

.readonly-table th,
.readonly-table td {
  padding: 7px 9px;
  border: 1px solid var(--line);
}

.table-wrap.compact {
  margin-top: 6px;
  border-radius: 8px;
}

.assign-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 2px;
}

.assign-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.assign-row:hover {
  border-color: #bfdbfe;
}

.assign-row.is-assigned {
  background: #f8fafc;
}

.assign-row input {
  width: auto;
  accent-color: var(--brand);
}

.assign-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.assign-name strong {
  font-size: 12.5px;
}

.assign-name small {
  font-size: 10.5px;
  color: var(--muted);
}

/* =========================================================
   Progress
   ========================================================= */

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.progress-meta strong {
  color: var(--ink);
  font-size: 11px;
}

.progress {
  height: 6px;
  background: #e9eef6;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #0ea5a4);
  transition: width 0.35s ease;
}

.progress-wrap.compact .progress {
  height: 5px;
}

.progress-wrap.compact .progress-meta {
  font-size: 10.5px;
}

/* =========================================================
   Tabele — odczyt z PDF, edycja i podgląd
   ========================================================= */

.pdf-help-text {
  flex: 1;
  min-width: 0;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: #dbeafe;
  flex: none;
}

.segmented button {
  border: 0;
  background: transparent;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.segmented button:hover {
  background: rgba(255, 255, 255, 0.55);
}

.segmented button.active {
  background: #fff;
  color: var(--brand-700);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.info-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
}

.info-note > svg {
  flex: none;
  margin-top: 1px;
}

.info-note-stack {
  flex-direction: column;
  gap: 6px;
}

.info-note-stack > div {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.info-note-muted {
  color: #64748b;
  background: #f8fafc;
  border-color: var(--line);
  border-radius: 7px;
  padding: 6px 8px;
}

.info-note-actions {
  justify-content: flex-end;
}

.crop-preview.compact img {
  max-height: 140px;
}

.table-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.table-editor-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.table-editor-meta .field span {
  font-size: 11.5px;
  font-weight: 750;
  color: #334155;
}

.table-editor-hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.table-editor-hint strong {
  color: #334155;
}

.table-editor-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.table-editor-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.table-editor-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  background: #fff;
}

.edit-table {
  font-size: 12px;
  background: #fff;
}

.edit-table th,
.edit-table td {
  border: 1px solid var(--line);
  padding: 5px;
  vertical-align: top;
}

.edit-table thead th {
  background: #f1f5f9;
}

.edit-table .row-index {
  width: 58px;
  min-width: 58px;
  text-align: center;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.edit-table .row-number {
  display: block;
}

.edit-table .row-actions,
.edit-table .col-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.edit-table .row-actions {
  margin-top: 3px;
}

.edit-table .row-actions button,
.edit-table .col-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 1px;
  border-radius: 3px;
}

.edit-table .row-actions button:hover,
.edit-table .col-actions button:hover {
  color: var(--red);
  background: #fee2e2;
}

.edit-table .row-actions button:disabled,
.edit-table .col-actions button:disabled,
.table-editor-actions button:disabled {
  opacity: 0.35;
  cursor: default;
  color: #94a3b8;
  background: transparent;
}

.edit-table .col-head {
  display: flex;
  gap: 3px;
  align-items: center;
}

.edit-table .col-head input {
  min-width: 70px;
  padding: 5px 7px;
  font-size: 11px;
}

.edit-table .column-controls th {
  padding: 2px 5px;
  background: #f8fafc;
}

.edit-table .is-selected {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, 0.08);
}

.cell-editor {
  min-width: 110px;
}

.cell-editor input {
  width: 100%;
  padding: 5px 7px;
  font-size: 11.5px;
  border-color: #e2e8f0;
}

.cell-editor.is-fixed {
  background: #f8fafc;
}

.cell-editor.is-answer {
  background: #fffbeb;
}

.cell-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  border: 1px solid var(--line);
  background: #fff;
  color: #64748b;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 9.5px;
  cursor: pointer;
}

.cell-toggle:hover {
  color: var(--brand);
  border-color: #bfdbfe;
}

.header-cell {
  background: #eef2f7 !important;
}

.header-cell input {
  width: 100%;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 700;
}

.table-title {
  font-weight: 750;
  font-size: 12.5px;
  color: #334155;
  margin: 0 0 7px;
}

.fill-table .fixed-cell,
.readonly-table .fixed-cell {
  background: #f8fafc;
  color: #334155;
  white-space: pre-wrap;
}

.fill-table .answer-cell {
  background: #fffbeb;
}

.fill-table .answer-cell input {
  background: #fff;
}

.teacher-answer-cell {
  background: #fffbeb;
}

.teacher-value {
  font-weight: 650;
  color: var(--ink);
  min-height: 16px;
}

.teacher-value.empty {
  color: #94a3b8;
  font-weight: 500;
}

.student-answer-cell {
  background: #fffbeb;
}

.student-value {
  font-weight: 650;
  color: var(--ink);
  min-height: 16px;
}

.student-value.empty {
  color: #94a3b8;
  font-weight: 500;
}

.student-answer-cell.is-correct {
  background: var(--green-50);
}

.student-answer-cell.is-wrong {
  background: var(--red-50);
}

.review-legend {
  margin-bottom: 10px;
}

.expected-value {
  margin-top: 3px;
  font-size: 10px;
  color: #15803d;
  display: flex;
  gap: 3px;
  align-items: center;
}

.expected-answer {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  border-radius: 9px;
}

.expected-answer strong {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #166534;
}

.expected-answer div {
  margin-top: 5px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
  color: #14532d;
}

.student-leaf.informational {
  color: #94a3b8;
}

.student-leaf.informational .leaf-dot {
  background: #cbd5e1;
}

.student-leaf.informational .leaf-status {
  color: #94a3b8;
}

/* =========================================================
   Responsywność
   ========================================================= */

@media (max-width: 1180px) {
  .builder-grid {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .runner-grid {
    grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual {
    padding: 30px 24px 26px;
    min-height: auto;
  }

  .login-hero {
    margin-top: 20px;
    padding-top: 0;
  }

  .login-hero h1 {
    font-size: 34px;
  }

  .login-features,
  .login-art,
  .login-footnote {
    display: none;
  }

  .login-panel {
    padding: 26px 18px 40px;
  }

  .builder-grid,
  .runner-grid {
    grid-template-columns: 1fr;
  }

  .builder-tree,
  .runner-tree {
    position: static;
    max-height: none;
  }

  .tree-body {
    max-height: 340px;
  }

  .student-tree {
    max-height: 300px;
  }

  .builder-pdf {
    min-height: 480px;
  }

  .pdf-stage {
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .pdf-help {
    flex-wrap: wrap;
  }

  .segmented {
    width: 100%;
    justify-content: stretch;
  }

  .segmented button {
    flex: 1;
  }

  .table-editor-meta {
    flex-direction: column;
  }

  .info-note-actions {
    justify-content: flex-start;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 9px 14px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding-bottom: 1px;
  }

  .nav-link {
    padding: 7px 10px;
    font-size: 12.5px;
  }

  .user-chip-text {
    display: none;
  }

  .view {
    padding: 18px 14px 60px;
  }

  .page-head h1 {
    font-size: 25px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-grid,
  .student-exam-grid {
    grid-template-columns: 1fr;
  }

  .builder-head {
    gap: 10px;
  }

  .builder-title h1 {
    font-size: 20px;
  }

  .builder-actions {
    width: 100%;
  }

  .builder-actions .btn {
    flex: 1;
  }

  .pdf-toolbar {
    gap: 6px;
  }

  .pdf-select {
    max-width: 100%;
    flex: 1;
  }

  .pdf-nav {
    margin-left: 0;
  }

  .pdf-stage {
    padding: 12px;
    min-height: 340px;
  }

  .runner-head-right {
    width: 100%;
    justify-content: space-between;
  }

  .runner-progress {
    flex: 1;
  }

  .part-head,
  .answer-area,
  .part-foot {
    padding-left: 15px;
    padding-right: 15px;
  }

  .part-figure,
  .part-instructions,
  .part-content,
  .teacher-comment {
    margin-left: 15px;
    margin-right: 15px;
  }

  .part-title-wrap h2 {
    font-size: 18px;
  }

  .review-card-head {
    flex-direction: column;
  }

  .modal-overlay {
    padding: 2vh 10px;
  }

  .modal-body {
    padding: 15px;
  }

  .login-card {
    padding: 22px;
  }

  .demo-account {
    grid-template-columns: auto 1fr;
  }

  .demo-account code {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .part-nav {
    width: 100%;
    justify-content: space-between;
  }

  .drawing-toolbar {
    gap: 8px;
  }

  .drawing-actions {
    margin-left: 0;
  }
}

/* =========================================================
   Punkty i wyniki
   ========================================================= */

.score-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.score-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.score-value {
  font-size: 12px;
  color: var(--muted);
}

.score-value strong {
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.score-bar {
  height: 7px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 8px;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0ea5a4);
}

.score-note {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.runner-score {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.runner-score-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.runner-score .score-box {
  background: var(--green-50);
  border-color: #a7f3d0;
}

.runner-score .score-bar {
  background: #d1fae5;
}

.table-editor-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 0 3px;
}

.submission-exam {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.teacher-answer-cell.is-correct {
  background: var(--green-50);
}

.teacher-answer-cell.is-wrong {
  background: var(--red-50);
}

.grade-row .input-small[data-points-answer] {
  width: 74px;
}
