/* ================================================================
   MOJE KONTO
   Minimalny, dokumentowy panel. Fiolet prowadzi po interfejsie,
   a hierarchię budują głównie typografia, światło i cienkie linie.
   ================================================================ */

body {
  min-height: 100dvh;
  background: var(--paper);
}

.account-page {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 88px;
}

.account-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  padding: 5px 0 29px;
  border-bottom: 1px solid var(--line);
}

.account-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.045em;
  color: var(--ink);
}

.account-lead {
  margin: 9px 0 0;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.account-resume {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--ease);
}

.account-resume .ti { color: var(--subject); }
.account-resume:hover { border-color: color-mix(in srgb, var(--subject) 45%, var(--line)); color: var(--subject-dark); }
.account-resume:active { transform: translateY(1px); }
.account-resume:focus-visible,
.account-menu a:focus-visible,
.account-help:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--subject) 35%, transparent);
  outline-offset: 3px;
}

.account-notices { margin: 22px 0 0; }
.account-notices:empty { display: none; }

.account-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(44px, 6vw, 72px);
  align-items: start;
  margin-top: 36px;
}

.account-sidebar {
  position: sticky;
  top: 84px;
  min-width: 0;
}

.account-sidebar-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--line);
}

.account-sidebar-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--subject) 22%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--subject) 5%, var(--surface));
  color: var(--subject);
  font-family: 'Lexend', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
}

.account-sidebar-head div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.account-sidebar-head strong {
  overflow: hidden;
  color: var(--ink);
  font-family: 'Lexend', sans-serif;
  font-size: 0.81rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sidebar-head span:not(.account-sidebar-mark) {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  padding: 14px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.account-menu a {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.35;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.account-menu a + a { margin-top: 1px; }
.account-menu a:hover { background: var(--surface-alt); color: var(--ink); }
.account-menu a[aria-current="location"] { background: color-mix(in srgb, var(--subject) 6%, var(--surface)); color: var(--subject-dark); }
.account-menu .ti { color: var(--text-muted); font-size: 0.97rem; text-align: center; }
.account-menu a[aria-current="location"] .ti { color: var(--subject); }

.account-help {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
}

.account-help span { font-size: 0.68rem; }
.account-help strong { color: var(--ink); font-size: 0.72rem; white-space: nowrap; }
.account-help:hover strong { color: var(--subject); }

.account-content { min-width: 0; }

.account-section {
  scroll-margin-top: 94px;
  margin: 0 0 48px;
}

.account-section:last-child { margin-bottom: 0; }

/* Linijka pod ostatnią sekcją (program poleceń) – ton jak „Potrzebujesz pomocy?”. */
.account-foot {
  margin: 40px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.account-foot a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.account-foot a:hover { color: var(--subject); }
.account-section-head { margin: 0 0 14px; }

.account-section-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  letter-spacing: -0.03em;
  color: var(--ink);
}

.account-section-head p {
  max-width: 58ch;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.account-content .profile-card {
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(23, 20, 58, 0.025);
}

.account-profile-card { padding: 0 !important; }

.account-identity {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid color-mix(in srgb, var(--subject) 24%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--subject) 6%, var(--surface));
  color: var(--subject);
  font-family: 'Lexend', sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.account-identity-copy { min-width: 0; }
.account-identity-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-identity-copy span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-role {
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--subject) 16%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--subject) 5%, var(--surface));
  color: var(--subject-dark);
  font-family: var(--mono);
  font-size: 0.594rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.account-profile-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  padding: 11px 24px 17px;
}

.account-profile-rows .profile-row {
  display: block;
  min-width: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.account-profile-rows .profile-key {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 0.563rem;
  letter-spacing: 0.07em;
}

.account-profile-rows .profile-val {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 550;
  text-align: left;
}

.account-loading {
  display: grid;
  gap: 11px;
  padding: 26px;
}

.account-loading span {
  display: block;
  width: 100%;
  height: 13px;
  border-radius: 7px;
  background: var(--surface-alt);
}
.account-loading span:first-child { width: 42%; height: 26px; }
.account-loading span:last-child { width: 70%; }

.account-login-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 24px;
}
.account-login-state p { margin: 0; color: var(--text-soft); font-size: 0.88rem; }
.account-login-state .auth-submit {
  margin: 0;
  padding: 9px 14px;
  border-radius: 7px;
  background: var(--ink);
  font-size: 0.84rem;
  white-space: nowrap;
}
.account-login-state .auth-submit:hover { background: #241F52; }

.account-section--data .profile-card { border-left: 2px solid color-mix(in srgb, #B42318 42%, var(--line)); }
.account-content .invite-intro:last-child { margin-bottom: 0; }
.account-content a:not(.ank-cta-btn):not(.nav-auth-btn):not(.pd-item-link) { text-underline-offset: 3px; }
.account-content a:not(.ank-cta-btn):not(.nav-auth-btn):not(.pd-item-link):hover { text-decoration: underline; }
.account-content .auth-submit:active,
.account-content .nav-auth-btn:active,
.account-content .btn-danger-quiet:active { transform: translateY(1px); }

@media (max-width: 820px) {
  .account-layout { grid-template-columns: 185px minmax(0, 1fr); gap: 32px; }
  .account-sidebar-head { padding-inline: 6px; }
  .account-menu a { padding-inline: 7px; }
  .account-help { align-items: flex-start; flex-direction: column; gap: 2px; padding-inline: 6px; }
  .account-content .profile-card { padding: 23px; }
  .account-profile-card { padding: 0 !important; }
}

@media (max-width: 700px) {
  .account-page { width: min(100% - 32px, 640px); padding: 30px 0 64px; }
  .account-hero { grid-template-columns: 1fr; align-items: start; gap: 19px; padding: 3px 0 24px; }
  .account-hero h1 { font-size: clamp(2rem, 10vw, 2.7rem); }
  .account-resume { justify-self: start; }
  .account-layout { display: block; margin-top: 24px; }
  .account-sidebar { position: sticky; top: 60px; z-index: 20; padding: 6px 0; border-bottom: 1px solid var(--line); background: rgba(251, 250, 247, 0.96); backdrop-filter: blur(10px); }
  .account-sidebar-head, .account-help { display: none; }
  .account-menu {
    display: flex;
    max-height: none;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    scrollbar-width: none;
  }
  .account-menu::-webkit-scrollbar { display: none; }
  /* Sygnał, że menu sekcji da się przewinąć w bok. Wcześniej jedyną wskazówką
     była ucięta etykieta ostatniej zakładki – czyli coś, co wygląda na błąd,
     a nie na zaproszenie do gestu (audyt nawigacji §7). */
  .account-menu-wrap { position: relative; }
  .account-menu-wrap::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 34px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(251, 250, 247, 0), rgba(251, 250, 247, 0.96));
  }
  .account-menu a,
  .account-menu a + a {
    display: inline-flex;
    min-height: 36px;
    flex: 0 0 auto;
    margin: 0;
    padding: 7px 9px;
    white-space: nowrap;
  }
  .account-content { margin-top: 30px; }
  .account-section { margin-bottom: 42px; scroll-margin-top: 116px; }
  .account-section-head { margin-bottom: 12px; }
}

@media (max-width: 520px) {
  .account-page { width: min(100% - 24px, 480px); padding-top: 24px; }
  .account-lead { margin-top: 8px; }
  .account-content .profile-card { padding: 19px 16px; }
  .account-profile-card { padding: 0 !important; }
  .account-identity { grid-template-columns: 44px minmax(0, 1fr); gap: 11px; padding: 18px 16px; }
  .account-avatar { width: 44px; height: 44px; border-radius: 10px; }
  .account-role { grid-column: 1 / -1; justify-self: start; }
  .account-profile-rows { grid-template-columns: 1fr; padding: 7px 16px 14px; }
  .account-login-state { grid-template-columns: 1fr; padding: 20px 16px; }
  .account-login-state .auth-submit { width: 100%; max-width: none !important; }
  .invite-actions { display: grid; }
  .invite-actions .auth-submit { width: 100%; max-width: none; }
  .invite-link-input { min-width: 100%; }
  .invite-link-row .nav-auth-btn { flex: 1 1 auto; text-align: center; }
  .cat-add-row { display: grid; }
  .cat-add-row .invite-link-input,
  .cat-add-row .auth-submit { width: 100%; max-width: none !important; }
  .pd-item { align-items: flex-start; flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .account-resume,
  .account-menu a { transition: none; }
}

/* ================================================================
   MOI UCZNIOWIE – szczegóły ucznia (panel nauczyciela)
   Checklisty „oznacz za ucznia": dział → kategoria → hasło, rocznik → arkusz.
   Wiersz = checkbox + tytuł (label) + osobna strzałka-link do materiału.
   ================================================================ */
.pd-note { margin: 0 0 10px; font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); }
.pd-msg { margin: 0 0 8px; }
.pd-msg:empty { display: none; }
.pd-summary .pd-stats-years { margin-top: 16px; }
.pd-summary .stx-years-grid { max-width: 100%; }

.pd-sec { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pd-sec + .pd-sec { margin-top: 8px; }
.pd-sec > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; list-style: none;
  border-left: 3px solid var(--cat, var(--subject)); border-radius: 10px;
}
.pd-sec > summary::-webkit-details-marker { display: none; }
.pd-sec[open] > summary { border-bottom: 1px solid var(--line-soft); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.pd-sec[data-section="algorytmy"]   { --cat: #6C2BD9; }
.pd-sec[data-section="bazy-danych"] { --cat: #2563EB; }
.pd-sec[data-section="excel"]       { --cat: #217346; }
.pd-sec[data-section="teoria"]      { --cat: #E8890C; }
.pd-sec[data-section="arkusze"]     { --cat: var(--gold); }
.pd-sec-lab { font-family: 'Lexend', sans-serif; font-weight: 700; font-size: 0.813rem; color: var(--ink); }
.pd-sec-num { margin-left: auto; }
.pd-sec-caret { color: var(--text-muted); transition: transform .15s var(--ease); }
.pd-sec[open] .pd-sec-caret { transform: rotate(180deg); }

.pd-cat { padding: 6px 12px 8px; }
.pd-cat + .pd-cat { border-top: 1px solid var(--line-soft); }
.pd-cat-lab {
  margin: 4px 0 2px; font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted);
}

.pd-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.pd-cat .pd-row:last-child { border-bottom: 0; }
.pd-row--sub { padding-left: 26px; }
.pd-row--sub .pd-row-lab { font-weight: 500; font-size: 0.8rem; }
.pd-tick { width: 17px; height: 17px; margin: 0; accent-color: var(--cat, var(--subject)); cursor: pointer; flex: 0 0 auto; }
.pd-tick:disabled { opacity: .5; cursor: progress; }
.pd-row-lab { font-size: 0.86rem; font-weight: 600; color: var(--text); cursor: pointer; line-height: 1.35; overflow-wrap: anywhere; }
.pd-row.is-done .pd-row-lab { color: var(--text-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--cat, var(--subject)) 45%, transparent); }
.pd-row-meta { font-family: var(--mono); font-size: 0.625rem; color: var(--text-muted); white-space: nowrap; }
.pd-row-go {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; color: var(--text-muted);
  text-decoration: none !important;
}
.pd-row-go:hover { background: var(--surface-alt); color: var(--subject); }
.pd-row-go:focus-visible { outline: 2px solid color-mix(in srgb, var(--subject) 35%, transparent); outline-offset: 2px; }

@media (max-width: 520px) {
  .pd-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pd-row-meta { grid-column: 2; grid-row: 2; }
  .pd-row--sub { padding-left: 18px; }
}
@media (prefers-reduced-motion: reduce) { .pd-sec-caret { transition: none; } }

/* ================================================================
   WSZYSCY UŻYTKOWNICY – panel właściciela / admina
   Karta nauczyciela (nagłówek = kto + fakty w jednej linii, po rozwinięciu
   kafle aktywności i lista uczniów) i na końcu grupa „bez nauczyciela".
   Lekko: Inter 500, ramki --line-soft, kolor tylko na kropce świeżości.
   ================================================================ */
.au-summary {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
/* Flex zamiast siatki: ostatni rząd rozciąga się na całą szerokość, więc przy
   7 kaflach nie zostaje puste pole (por. zasada „bez pustych pól" na koncie). */
.au-summary .au-stat, .au-stats .au-stat { flex: 1 1 150px; }
.au-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--surface);
}
.au-stat-k { font-size: 0.66rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.au-stat-v { font-family: 'Lexend', sans-serif; font-weight: 600; font-size: 1.05rem; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.au-stat-s { font-size: 0.72rem; line-height: 1.35; color: var(--text-soft); }

.au-staff { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.au-staff + .au-staff { margin-top: 10px; }
.au-staff--orphans { border-style: dashed; }
.au-staff-head {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: none; border: none; cursor: pointer; text-align: left; font-family: inherit; color: inherit;
}
.au-staff-head:hover { background: var(--surface-alt); }
.au-staff-head:focus-visible { outline: 2px solid color-mix(in srgb, var(--subject) 35%, transparent); outline-offset: -2px; }
.au-avatar {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--subject) 8%, var(--surface));
  color: var(--subject-dark); font-family: 'Lexend', sans-serif; font-weight: 600; font-size: 0.8rem;
}
.au-avatar--none { background: var(--surface-alt); color: var(--text-muted); font-size: 1rem; }
.au-who { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.au-who strong { font-weight: 600; color: var(--text); font-size: 0.93rem; overflow-wrap: anywhere; }
.au-who span { font-size: 0.76rem; color: var(--text-soft); overflow-wrap: anywhere; }
.au-role { flex: 0 0 auto; }
.au-role--owner { color: var(--gold-ink); border-color: var(--gold-soft); background: var(--gold-chip); }
.au-role--teacher { color: var(--text-soft); border-color: var(--line); background: var(--surface-alt); }
.au-facts, .au-pupil-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-left: auto; justify-content: flex-end; }
.au-fact { font-size: 0.74rem; color: var(--text-soft); white-space: nowrap; }
.au-seen { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--text-soft); white-space: nowrap; }
.au-seen i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.au-seen--hot i  { background: var(--live, #16A34A); }
.au-seen--warm i { background: var(--gold); }
.au-seen--cold i { background: var(--line); }
.au-seen--never  { color: var(--text-muted); }
.au-caret { flex: 0 0 auto; color: var(--text-muted); transition: transform .15s var(--ease); }
.au-staff-head.is-open .au-caret { transform: rotate(180deg); }
.au-staff-body { padding: 4px 16px 16px; border-top: 1px solid var(--line-soft); }
.au-stats {
  display: flex; flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.au-stats .au-stat { background: var(--surface-alt); border-color: transparent; }
.au-stats--pupil { margin: 10px 0 0; }
.au-stats--pupil .au-stat { background: var(--surface); border-color: var(--line-soft); }
.au-pupils-heading { margin-top: 16px; }
.au-pupil .pd-pupil-head { gap: 10px; padding: 11px 14px; }
.au-pupil .pd-pupil-name { font-weight: 600; }
.au-pupil .pd-pupil-email { font-size: 0.78rem; }
.au-pupil .au-pupil-facts .ank-badge { margin-left: 0; }
.au-pupil-detail { margin-top: 6px; }
/* Tryb podglądu: wyszarzony checkbox to informacja, nie „trwa zapis". */
.pd-detail--ro .pd-tick:disabled { cursor: default; opacity: .45; }
.pd-detail--ro .pd-row-lab { cursor: default; }

@media (max-width: 700px) {
  .au-staff-head { flex-wrap: wrap; }
  .au-facts { margin-left: 0; width: 100%; justify-content: flex-start; padding-left: 48px; }
  .au-caret { position: absolute; right: 16px; }
  .au-staff-head { position: relative; padding-right: 40px; }
  .au-pupil .pd-pupil-head { flex-wrap: wrap; }
  .au-pupil-facts { margin-left: 0; width: 100%; justify-content: flex-start; }
}
