/* assets/style.css */
/* ================== корінь і змінні ================== */
:root {
  --bg: #f2f3f8;
  --surface: #ffffff;
  --primary: #5a35ff;
  --primary-soft: rgba(90, 53, 255, 0.08);
  --primary-grad: linear-gradient(120deg, #5a35ff 0%, #b666ff 100%);
  --text: #1f2430;
  --muted: #707791;
  --radius-lg: 1.5rem;
  --radius: 1rem;
  --shadow-sm: 0 10px 30px rgba(14, 26, 45, 0.06);
  --shadow-card: 0 16px 40px rgba(14, 26, 45, 0.03);
  --sidebar: 240px;
  --danger: #ff5271;

  /* типографіка */
  --fs-h1: clamp(2rem, 2vw, 2.4rem);
  --fs-h2: clamp(1.8rem, 1.4vw, 2rem);
  --fs-h3: clamp(1.3rem, 1.15vw, 1.5rem);
  --fs-body: 1rem; /* 16px — базовий текст */
  --fs-small: 0.9rem; /* дрібний, але не 12px */
}

/* ================== ресет ================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Commissioner", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.45;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font-family: inherit;
}

/* ================== лейаут ================== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid rgba(25, 33, 68, 0.06);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.sidebar__brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.sidebar__img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.sidebar__brand-text h1 {
  font-size: 1rem;
  margin: 0;
}
.sidebar__brand-text p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar__title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin: 0 0 0.4rem 0.6rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-link {
  background: transparent;
  border: 0;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 0.9rem;
  font-weight: 500;
  color: #1f2430;
  cursor: pointer;
  transition: 0.12s;
}
.nav-link i {
  font-size: 1.25rem;
}
.nav-link.active,
.nav-link:hover {
  background: rgba(90, 53, 255, 0.12);
  color: #1f2430;
}

.sidebar__footer {
  margin-top: auto;
}
.sidebar-upgrade {
  background: linear-gradient(137deg, #5a35ff 0%, #b666ff 100%);
  border-radius: 1.05rem;
  padding: 1rem 0.8rem 1rem;
  color: #fff;
  box-shadow: 0 20px 35px rgba(90, 53, 255, 0.28);
}
.sidebar-upgrade h4 {
  font-size: 0.8rem;
  margin: 0 0 0.25rem;
}
.sidebar-upgrade p {
  font-size: 0.7rem;
  margin: 0 0 0.7rem;
}
.sidebar-upgrade .btn {
  width: 100%;
  background: #fff;
  color: #3a1ad6;
  font-size: 0.7rem;
}

/* ================== основна частина ================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ================== topbar ================== */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 3vw, 1.8rem);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 15;
  border-bottom: 1px solid rgba(25, 33, 68, 0.03);
  min-height: 60px;
}
.btn-icon {
  width: 35px;
  height: 35px;
  border-radius: 999px;
  border: none;
  background: #f5f6fe;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: #1f2430;
  cursor: pointer;
}
.mobile-toggle {
  display: none;
}
.topbar__right {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.topbar__user {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #fff;
  border-radius: 32px;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 0.25rem;
  padding-top: 0.25rem;
  box-shadow: 0 8px 30px rgba(100, 100, 111, 0.12);
  position: relative;
}
.topbar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: #e5e6ef;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.75rem;
}
.topbar__info h4 {
  margin: 0;
  font-size: 1rem;
}
.topbar__info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.user-caret {
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 999px;
}
.user-menu__toggle {
  display: none;
}
.user-menu {
  position: absolute;
  right: 0;
  top: 120%;
  background: #fff;
  border-radius: 1rem;
  min-width: 150px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.08);
  padding: 0.3rem 0.4rem;
  display: none;
}
.user-menu__item {
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-radius: 0.7rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 1rem;
  cursor: pointer;
}
.user-menu__item:hover {
  background: rgba(90, 53, 255, 0.08);
}
.user-menu__toggle:checked ~ .user-menu {
  display: block;
}

/* ================== контент ================== */
.content {
  padding: 1.6rem clamp(1rem, 3vw, 1.8rem) 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.7rem;
}
.view {
  display: none;
}
.view.active {
  display: block;
}

.page-title,
.page-title h2 {
  font-size: clamp(1.8rem, 1.8vw, 2rem);
  font-weight: 700;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

/* ================== універсальні штуки ================== */
.card {
  background: #fff;
  border-radius: 1.4rem;
  box-shadow: var(--shadow-card);
  padding: 1.25rem 1.5rem;
}
.small {
  font-size: var(--fs-small);
}
.text-muted {
  color: var(--muted);
}

.btn {
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.55rem 1.15rem;
  transition: 0.12s;
}
.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-light {
  background: rgba(90, 53, 255, 0.07);
  color: #272d3a;
}
.btn-dark {
  background: #191e2f;
  color: #fff;
}
.btn:hover {
  opacity: 0.98;
}

/* ================== ОГЛЯД ================== */
.dashboard-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 1rem;
  align-items: stretch;
}

.teacher-hero {
  background: var(--primary-grad);
  color: #fff;
  border-radius: 1.4rem;
  padding: 1.1rem 1.3rem 1.15rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 210px;
}
.teacher-hero h3 {
  margin-top: 0;
  font-size: clamp(1.3rem, 1.2vw, 1.45rem);
}
.teacher-hero p {
  font-size: 1rem;
  max-width: 42rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.05rem;
}
.hero-pill {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.4rem 0.75rem;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 1rem;
}
.hero-pill__title {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  color: #4f2be5;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.hero-small,
.hero-numbers {
  text-align: right;
  font-size: 0.95rem;
}

.social-card h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.social-card .text-muted {
  font-size: 0.9rem;
}
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.65rem 0 1rem;
}
.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(90, 53, 255, 0.08);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  color: #1f2430;
  text-decoration: none;
}

.grid {
  display: grid;
  gap: 1rem;
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.teacher-info-row {
  margin-top: 1.2rem; /* повернув вертикальний відступ */
}

/* ================== ОЛІМПІАДА ================== */
.olymp-head-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.2rem;
}
.olymp-main-card {
  background: var(--primary-grad);
  border-radius: 1.4rem;
  padding: 1.2rem 1.35rem 1.15rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 60%;
}
.olymp-main-card__header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}
.olymp-main-card__header p {
  margin: 0;
  font-size: 1rem;
}
.olymp-main-flex {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-direction: column;
}
.rank-pill--big {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  display: flex;
  gap: 0.55rem;
  align-items: center;
}
.rank-number {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  font-size: 1rem;
}
.rank-text {
  font-size: 0.95rem;
}
.ref-inline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ref-label {
  font-size: 0.9rem;
}
.ref-inline-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.ref-inline-code {
  background: #fff;
  color: #1f2430;
  padding: 0.45rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.35em;
  font-size: 1rem;
}

/* маленькі картки праворуч від банера */
.olymp-stats {
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  width: 40%;
  justify-content: space-between;
}
.olymp-stat-tile {
  background: #fff;
  border-radius: 1.2rem;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
  width: 33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}
.olymp-stat-tile p {
  margin: 0;
  font-size: 1rem;
  color: #4d5365;
  text-align: center;
}
.olymp-stat-tile h2 {
  margin: 0.35rem 0;
  font-size: 1.5rem;
}
.pill {
  display: inline-flex;
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
}
.pill-light {
  background: rgba(90, 53, 255, 0.07);
  color: #464c60;
}
.pill-success {
  background: rgba(135, 221, 162, 0.2);
  color: #348654;
}

/* таблиця */
.card-head h3 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}
.card-head .small {
  font-size: 0.9rem;
}
.olymp-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.class-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.class-tab {
  border: 0;
  background: rgba(90, 53, 255, 0.055);
  padding: 0.45rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.class-tab.active {
  background: rgba(90, 53, 255, 1);
  color: #fff;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  min-width: 620px;
  border-spacing: 0;
  border-collapse: separate;
}
.table thead th {
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  color: #7b8294;
  padding: 0.6rem 0.45rem;
  background: #f1f3ff;
}
.table tbody td {
  font-size: 0.9rem;
  padding: 0.55rem 0.45rem;
  background: #fff;
  border-bottom: 1px solid rgba(25, 33, 68, 0.03);
}
.table tbody tr:nth-child(even) td {
  background: #f9f9ff;
}

/* ================== КОРИСНЕ ================== */
.tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.tab {
  background: #fff;
  border-radius: 999px;
  border: 1px solid rgba(90, 53, 255, 0.09);
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.tab.active {
  background: rgba(90, 53, 255, 0.12);
  border-color: transparent;
}
.resource-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.1rem;
}
.resource-card {
  background: #fff;
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  max-width: 240px !important;
}
.resource-card__thumb {
  width: 100%;
  height: 130px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ff3f73;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.resource-card__body {
  padding: 0.7rem 0.8rem 0.75rem;
}
.resource-card__body h4 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.resource-card__body p {
  font-size: 0.9rem;
  color: var(--muted);
}
.resource-card__actions {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.resource-card__actions a, .resource-card__actions button {
  width: 100%;
}

/* ================== ПРОФІЛЬ ================== */
.profile-shell {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.profile-col-left--white {
  width: 40%;
}
.profile-col-right--white {
  width: 60%;
}

.profile-col-left--white,
.profile-col-right--white {
  background: #fff;
  border-radius: 1.4rem;
  padding: 1.1rem 1.1rem 1rem;
  box-shadow: var(--shadow-card);
}
.profile-box {
  background: #f9f9ff;
  border-radius: 1.1rem;
  padding: 1rem 1.1rem 1rem;
  margin-bottom: 0.9rem;
}
.profile-box h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1rem;
  margin-bottom: 0.4rem;
}
.profile-row span:first-child {
  color: #596074;
}
.geo-grid {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.geo-grid p {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.geo-pill {
  background: #d7ddff;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 1rem; /* тут підняв до 16px */
  display: inline-block;
}

/* права колонка – картки */
.prof-cards {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}
.prof-card {
  flex: 1;
  background: #f5f5ff;
  border-radius: 1rem;
  padding: 0.9rem 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.prof-card__head h4 {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}
.prof-card__body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.subject-chip,
.class-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #e6e8ff;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  line-height: 1;
  cursor: default;
}
.subject-chip.active {
  background: #5a35ff;
  color: #fff;
}
.prof-card__footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
}
.class-add-line {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.class-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(90, 53, 255, 0.21);
  padding: 0.5rem 0.7rem;
  font-size: 1rem;
  background: #fff;
}

/* коли JS вмикає режим редагування предметів */
.subjects-edit .subject-chip {
  cursor: pointer;
  outline: 2px dashed rgba(90, 53, 255, 0.35);
  background: #fff;
}
.subjects-edit .subject-chip.active {
  background: #5a35ff;
  color: #fff;
  outline: 0;
}

/* ================== адаптивність ================== */
/* ================== корінь і змінні ================== */
:root {
  --bg: #f2f3f8;
  --surface: #ffffff;
  --primary: #5a35ff;
  --primary-soft: rgba(90, 53, 255, 0.08);
  --primary-grad: linear-gradient(120deg, #5a35ff 0%, #b666ff 100%);
  --text: #1f2430;
  --muted: #707791;
  --danger: #ff5271;

  /* розміри: все через clamp */
  --radius-lg: clamp(1rem, 2vw, 1.5rem);
  --radius: clamp(0.75rem, 1.4vw, 1rem);
  --shadow-sm: 0 10px 30px rgba(14, 26, 45, 0.06);
  --shadow-card: 0 16px 40px rgba(14, 26, 45, 0.03);
  --sidebar: clamp(220px, 18vw, 240px);

  /* типографіка */
  --fs-h1: clamp(2rem, 2vw, 2.4rem);
  --fs-h2: clamp(1.8rem, 1.4vw, 2rem);
  --fs-h3: clamp(1.3rem, 1.15vw, 1.5rem);
  --fs-body: clamp(0.95rem, 1.1vw, 1rem);
  --fs-small: clamp(0.8rem, 0.9vw, 0.9rem);

  /* відступи */
  --pad-page: clamp(1rem, 3vw, 1.8rem);
  --gap-lg: clamp(1rem, 2.3vw, 1.7rem);
  --gap-md: clamp(0.7rem, 1.8vw, 1rem);
  --gap-sm: clamp(0.4rem, 1.2vw, 0.7rem);
}

/* ================== ресет ================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Commissioner", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.45;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font-family: inherit;
}

/* ================== лейаут ================== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar);
  background: #fff;
  border-right: 1px solid rgba(25, 33, 68, 0.06);
  padding: clamp(1.2rem, 2vw, 1.5rem) clamp(0.7rem, 1.2vw, 1rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2.2vw, 2rem);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.sidebar__brand {
  display: flex;
  gap: clamp(0.5rem, 1vw, 0.75rem);
  align-items: center;
}
.sidebar__img {
  width: clamp(32px, 3vw, 38px);
  height: clamp(32px, 3vw, 38px);
  object-fit: contain;
}
.sidebar__brand-text h1 {
  font-size: clamp(0.95rem, 1.1vw, 1rem);
  margin: 0;
}
.sidebar__brand-text p {
  margin: 0;
  font-size: clamp(0.65rem, 0.9vw, 0.75rem);
  color: var(--muted);
}

.sidebar__title {
  font-size: clamp(0.55rem, 0.7vw, 0.7rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  margin: 0 0 0.4rem clamp(0.5rem, 1vw, 0.6rem);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 1vw, 0.4rem);
}

.nav-link {
  background: transparent;
  border: 0;
  display: flex;
  gap: clamp(0.45rem, 1.1vw, 0.6rem);
  align-items: center;
  padding: clamp(0.45rem, 1.2vw, 0.55rem) clamp(0.6rem, 1.3vw, 0.75rem);
  border-radius: clamp(0.6rem, 1.2vw, 0.9rem);
  font-weight: 500;
  color: #1f2430;
  cursor: pointer;
  transition: 0.12s;
}
.nav-link i {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
}
.nav-link.active,
.nav-link:hover {
  background: rgba(90, 53, 255, 0.12);
  color: #1f2430;
}

/* ================== основна частина ================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ================== topbar ================== */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: clamp(0.6rem, 1.2vw, 1rem);
  padding: clamp(0.55rem, 1.1vw, 0.7rem) var(--pad-page);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 15;
  border-bottom: 1px solid rgba(25, 33, 68, 0.03);
  min-height: clamp(56px, 6.4vw, 60px);
}
.btn-icon {
  width: clamp(32px, 3.4vw, 35px);
  height: clamp(32px, 3.4vw, 35px);
  border-radius: 999px;
  border: none;
  background: #f5f6fe;
  display: grid;
  place-items: center;
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  color: #1f2430;
  cursor: pointer;
}
.mobile-toggle {
  display: none;
}
.topbar__right {
  display: flex;
  gap: clamp(0.5rem, 1.1vw, 0.7rem);
  align-items: center;
}

.topbar__user {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem clamp(0.8rem, 1.4vw, 1rem);
  box-shadow: 0 8px 30px rgba(100, 100, 111, 0.12);
  position: relative;
}
.topbar__avatar {
  width: clamp(30px, 3.2vw, 34px);
  height: clamp(30px, 3.2vw, 34px);
  border-radius: 9999px;
  background: #e5e6ef;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.75rem;
}

/* ================== контент ================== */
.content {
  padding: clamp(1rem, 2vw, 1.6rem) var(--pad-page) clamp(1.6rem, 2.5vw, 2.4rem);
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}
.view {
  display: none;
}
.view.active {
  display: block;
}

.page-title,
.page-title h2 {
  font-size: clamp(1.6rem, 1.7vw, 2rem);
  font-weight: 700;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

/* ================== універсальні штуки ================== */
.card {
  background: #fff;
  border-radius: clamp(1rem, 1.6vw, 1.4rem);
  box-shadow: var(--shadow-card);
  padding: clamp(1rem, 1.7vw, 1.5rem);
}
.small {
  font-size: var(--fs-small);
}
.text-muted {
  color: var(--muted);
}

.btn {
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-size: clamp(0.9rem, 1vw, 1rem);
  padding: clamp(0.4rem, 0.8vw, 0.55rem) clamp(1rem, 1.2vw, 1.15rem);
  transition: 0.12s;
}

/* ================== ОГЛЯД (групи) ================== */
.dashboard-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: var(--gap-md);
  align-items: stretch;
}
.teacher-hero {
  background: var(--primary-grad);
  color: #fff;
  border-radius: clamp(1rem, 1.6vw, 1.4rem);
  padding: clamp(1rem, 1.4vw, 1.3rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: clamp(180px, 22vw, 210px);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 1vw, 0.7rem);
  margin-top: clamp(0.6rem, 1vw, 1.05rem);
}

/* ================== адаптивність ================== */

/* 1) до 1180 — трохи стискаємо, але ще не в колонку */
@media (max-width: 1180px) {
  .dashboard-top {
    grid-template-columns: 1fr;
  }
  .topbar {
    justify-content: space-between !important;
  }
}

/* 2) планшети і телефони у портреті — ВСЕ вертикально */
@media (max-width: 1024px) and (orientation: portrait) {
  .layout {
    flex-direction: column;
  }

  /* сайдбар ховаємо і показуємо бургер */
  .sidebar {
    position: fixed;
    left: calc(var(--sidebar) * -1);
    top: 0;
    height: 100vh;
    transition: 0.25s;
    width: var(--sidebar);
  }
  .sidebar.sidebar--open {
    left: 0;
  }
  .mobile-toggle {
    display: inline-grid;
  }

  /* topbar на всю ширину, кнопки в ряд */
  .topbar {
    justify-content: space-between !important;
  }

  /* контент — одна колонка */
  .content {
    padding-inline: clamp(0.75rem, 3vw, 1rem);
  }

  /* ВСІ групи/ряди — в стовпчик */
  .dashboard-top,
  .grid.grid-3,
  .olymp-head-row,
  .profile-shell,
  .prof-cards,
  .resource-grid {
    display: flex;
    flex-direction: column;
  }

  /* блоки Олімпіади */
  .olymp-stats {
    width: 100%;
    flex-direction: column;
  }

  /* профільні 40/60 → 100% */
  .profile-col-left--white,
  .profile-col-right--white {
    width: 100%;
  }

  /* таблиці — скрол */
  .table-wrapper {
    overflow-x: auto;
  }
}

/* 3) просто до 1024 (горизонт теж) — тримаємо мобільне меню */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: calc(var(--sidebar) * -1);
  }
  .sidebar.sidebar--open {
    left: 0;
  }
  .mobile-toggle {
    display: inline-grid;
  }
  .prof-cards {
    flex-direction: column;
  }
}

/* 4) дрібні телефони */
@media (max-width: 520px) {
  .topbar__info p {
    display: none;
  }
  .teacher-hero {
    flex-direction: column;
  }
  .resource-card {
    max-width: 100% !important;
  }
  .table {
    min-width: 540px;
  }
}
/* мобільна/портретна адаптація для блоку Олімпіада */
@media (max-width: 1024px) {
  .olymp-head-row {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2vw, 1rem);
  }

  .olymp-main-card,
  .olymp-stats {
    width: 100%;
    max-width: none;
  }

  /* щоб кнопка "Скопіювати посилання" не з’їжджала */
  .ref-inline-row {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .olymp-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .olymp-stat-tile {
    flex: 1 1 calc(33.33% - 0.6rem);
    min-width: 140px;
  }
}
#sidebarOverlay {
  backdrop-filter: blur(1px);
}
/* =========== AUTH PAGE =========== */
.auth-body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #f1eaff 0%, #eef0ff 45%, #eaedf4 90%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.2rem, 3vw, 2.5rem);
}

.auth-shell {
  width: min(1100px, 100%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border-radius: clamp(1.2rem, 2vw, 1.7rem);
  box-shadow: 0 18px 50px rgba(35, 43, 76, 0.12);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(350px, 0.7fr);
  gap: clamp(1rem, 2.4vw, 2rem);
  overflow: hidden;
}

.auth-left {
  background: radial-gradient(circle at top, rgba(84, 40, 255, 0.07), rgba(84, 40, 255, 0)) #fff;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.4vw, 1.25rem);
  border-right: 1px solid rgba(255,255,255,0.1);
}

.auth-brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.auth-logo {
  width: clamp(40px, 5vw, 50px);
  height: auto;
}
.auth-tag {
  font-size: clamp(0.65rem, 1.1vw, 0.75rem);
  text-transform: uppercase;
  color: #5a35ff;
  margin: 0 0 0.25rem;
  letter-spacing: 0.12em;
}
.auth-left h1 {
  font-size: clamp(1.6rem, 2.3vw, 2rem);
  margin: 0;
}

.auth-lead {
  color: #475066;
  max-width: 32rem;
  font-size: clamp(0.9rem, 1.1vw, 1rem);
}

.auth-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
  font-size: clamp(0.85rem, 1.05vw, 0.95rem);
  color: #1f2430;
}

.auth-mini-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.auth-stat {
  background: rgba(90, 53, 255, 0.05);
  border: 1px solid rgba(90, 53, 255, 0.16);
  border-radius: 1rem;
  padding: 0.5rem 0.9rem;
}
.auth-stat span {
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
}
.auth-stat p {
  font-size: 0.8rem;
  margin: 0;
  color: #5f6676;
}

.auth-right {
  background: #fff;
  padding: clamp(1.3rem, 2.3vw, 2rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card {
  background: #fff;
  border-radius: clamp(1rem, 1.5vw, 1.2rem);
  border: 1px solid rgba(25, 32, 56, 0.02);
  box-shadow: 0 12px 30px rgba(48, 44, 88, 0.03);
}
.auth-card h2 {
  font-size: clamp(1.3rem, 1.4vw, 1.5rem);
  margin-bottom: 0.35rem;
}
.auth-sub {
  color: #6c7383;
  font-size: 0.9rem;
  margin-bottom: 1.05rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.auth-form label {
  font-weight: 500;
  font-size: 0.85rem;
}
.input-shell {
  display: flex;
  align-items: center;
  background: #f5f6fe;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem 0.4rem 0.6rem;
}
.input-shell:focus-within {
  border-color: rgba(90, 53, 255, 0.4);
  background: #fff;
}
.input-icon {
  color: #5a35ff;
  display: grid;
  place-items: center;
}
.input-shell input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
  padding: 0.35rem 0.2rem;
}

.password-shell {
  position: relative;
}
.pass-toggle {
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: #5a35ff;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}

.auth-btn {
  margin-top: 0.4rem;
  width: 100%;
  background: linear-gradient(120deg, #5a35ff 0%, #b666ff 100%);
  color: #fff;
  border-radius: 0.9rem;
  padding: 0.6rem 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.auth-btn:hover {
  opacity: 0.98;
}

.auth-message {
  min-height: 1.2rem;
  font-size: 0.78rem;
  margin-top: 0.25rem;
  color: var(--muted);
}

.auth-footer {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: #7b8394;
}
.auth-footer a {
  color: #5a35ff;
  text-decoration: none;
}
.auth-footer a:hover {
  text-decoration: underline;
}

.auth-bottom-note {
  margin-top: 1rem;
  font-size: 0.7rem;
  color: rgba(0,0,0,0.35);
}

/* мобілки / вузькі екрани */
@media (max-width: 880px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-left {
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.03);
  }
  .auth-right {
    padding-top: 1rem;
  }
  .auth-body {
    padding: 0;
  }
}
@media (max-width: 520px) {
  .auth-left {
    padding: 1.1rem 1rem 0.8rem;
  }
  .auth-right {
    padding: 1rem;
  }
  .auth-card {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
/* мобільний спрощений логін */
@media (max-width: 540px) {
  /* прибираємо список фіч і маленькі картки */
  .auth-list,
  .auth-mini-stats {
    display: none;
  }

  /* більше повітря з боків */
  .auth-body {
    padding: 1rem clamp(0.75rem, 4vw, 1.2rem);
  }

  .auth-shell {
    width: 100%;
    border-radius: 1.1rem;
  }

  .auth-left,
  .auth-right {
    padding-inline: clamp(0.8rem, 4vw, 1.2rem);
  }
}
.resource-card__thumb {
  background:
    radial-gradient(circle at 2px 2px, rgba(90,53,255,.12) 2px, transparent 2px) 0 0/18px 18px,
    linear-gradient(135deg, #f7f7ff, #eef0ff 60%, #eaefff);
}
/* ===== ЛІДЕРБОРД: мобільна вёрстка без горизонтального скролу ===== */
@media (max-width: 560px) {
  /* вимикаємо примусовий скрол і ширину */
  #view-leaderboard .table-wrapper {
    overflow-x: visible;
  }
  #view-leaderboard .table {
    min-width: 0;           /* перекриває global: min-width:620px */
    table-layout: fixed;    /* щоб колонки стискались і переносили текст */
  }

  /* клітинки: перенос, центр по вертикалі, трохи щільніше */
  #view-leaderboard .table th,
  #view-leaderboard .table td {
    white-space: normal;    /* дозволяємо переноси ПІБ */
    word-wrap: break-word;
    vertical-align: middle; /* центр по вертикалі */
    padding: 0.5rem 0.45rem;
  }

  /* компактні ширини для № та "Реф. учні" */
  #view-leaderboard .table th:nth-child(1),
  #view-leaderboard .table td:nth-child(1) {
    width: 48px;
    text-align: center;
  }
  #view-leaderboard .table th:nth-child(3),
  #view-leaderboard .table td:nth-child(3) {
    width: 80px;
    text-align: center;
  }
}
/* ===== Інфо-блок над лідербордом ===== */
.notice-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  border: 1px solid rgba(90,53,255,0.15);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.8rem;
}
.notice-card__icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 6px 18px rgba(90,53,255,0.15);
}
.notice-card__icon i {
  font-size: 1.3rem;
}
.notice-card__body h4 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}
.notice-card__body p {
  margin: 0.15rem 0 0;
  color: var(--text);
}

/* мобільний вигляд: усе читається, нічого не скролиться */
@media (max-width: 560px) {
  .notice-card {
    padding: 0.8rem 0.85rem;
  }
  .notice-card__icon {
    width: 32px; height: 32px;
  }
  #view-leaderboard .table-wrapper { overflow-x: visible; }
  #view-leaderboard .table { min-width: 0; table-layout: fixed; }
  #view-leaderboard .table th,
  #view-leaderboard .table td {
    white-space: normal;
    word-wrap: break-word;
    vertical-align: middle;
    text-align: center; /* центр по вертикалі/горизонталі на вузьких */
  }
  #view-leaderboard .table th:nth-child(1),
  #view-leaderboard .table td:nth-child(1) { width: 48px; }
  #view-leaderboard .table th:nth-child(3),
  #view-leaderboard .table td:nth-child(3) { width: 84px; }
}
