/* ZemGuru modular styles 06/16. Original cascade order preserved. */
/* Step 40: student progress page useful KPI cards and safe right rail layout */
body[data-role="student"][data-active="progress"] .progress-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 320px);
  gap: 24px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body[data-role="student"][data-active="progress"] .progress-main,
body[data-role="student"][data-active="progress"] .progress-modules,
body[data-role="student"][data-active="progress"] .progress-module-list,
body[data-role="student"][data-active="progress"] .progress-sidebar,
body[data-role="student"][data-active="progress"] .progress-sidebar .panel {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

body[data-role="student"][data-active="progress"] .progress-sidebar {
  position: static;
  width: 100%;
  z-index: 1;
}

body[data-role="student"][data-active="progress"] .progress-kpi-grid-filled {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

body[data-role="student"][data-active="progress"] .progress-card-filled {
  min-height: 0;
  padding: 18px;
  gap: 12px;
  align-content: start;
  overflow: hidden;
}

body[data-role="student"][data-active="progress"] .progress-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

body[data-role="student"][data-active="progress"] .progress-card-head h2 {
  margin: 0;
}

body[data-role="student"][data-active="progress"] .mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf7ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-role="student"][data-active="progress"] .mini-badge.amber {
  background: #fff2d9;
  color: #dd8300;
}

body[data-role="student"][data-active="progress"] .progress-card-body {
  display: grid;
  gap: 12px;
  align-items: center;
}

body[data-role="student"][data-active="progress"] .progress-card-overview {
  grid-template-columns: 104px minmax(0, 1fr);
}

body[data-role="student"][data-active="progress"] .progress-card-overview .ring {
  margin: 0;
}

body[data-role="student"][data-active="progress"] .progress-card-summary {
  display: grid;
  gap: 6px;
  min-width: 0;
}

body[data-role="student"][data-active="progress"] .progress-card-summary strong {
  font-size: 17px;
}

body[data-role="student"][data-active="progress"] .progress-card-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

body[data-role="student"][data-active="progress"] .progress-card-checks,
body[data-role="student"][data-active="progress"] .plot-status-list.compact {
  display: grid;
  gap: 8px;
}

body[data-role="student"][data-active="progress"] .progress-card-checks span,
body[data-role="student"][data-active="progress"] .plot-status-list.compact span {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f6faf7;
  color: #1f3d2e;
  font-weight: 750;
  line-height: 1.25;
}

body[data-role="student"][data-active="progress"] .progress-module-row {
  grid-template-columns: 86px minmax(150px, 1fr) 124px 72px 116px 82px 112px;
  gap: 10px;
  align-items: center;
}

body[data-role="student"][data-active="progress"] .progress-module-row .btn {
  min-width: 0;
  width: 100%;
  padding-left: 10px;
  padding-right: 10px;
  white-space: normal;
  line-height: 1.15;
}

body[data-role="student"][data-active="progress"] .module-index {
  white-space: nowrap;
}

body[data-role="student"][data-active="progress"] .module-title strong,
body[data-role="student"][data-active="progress"] .module-title span,
body[data-role="student"][data-active="progress"] .progress-module-row strong,
body[data-role="student"][data-active="progress"] .progress-module-row small {
  overflow-wrap: anywhere;
}

body[data-role="student"][data-active="progress"] .progress-rail-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

body[data-role="student"][data-active="progress"] .progress-rail-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

body[data-role="student"][data-active="progress"] .progress-sidebar .mentor-card .row-actions {
  grid-template-columns: 1fr;
}

@media (max-width: 1650px) {
  body[data-role="student"][data-active="progress"] .progress-page-layout {
    grid-template-columns: 1fr;
  }
  body[data-role="student"][data-active="progress"] .progress-sidebar {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  body[data-role="student"][data-active="progress"] .progress-kpi-grid-filled {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body[data-role="student"][data-active="progress"] .progress-module-row {
    grid-template-columns: 84px minmax(0, 1fr) 130px 92px;
  }
  body[data-role="student"][data-active="progress"] .progress-module-row > div:nth-of-type(4),
  body[data-role="student"][data-active="progress"] .progress-module-row > div:nth-of-type(5) {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  body[data-role="student"][data-active="progress"] .progress-kpi-grid-filled,
  body[data-role="student"][data-active="progress"] .progress-card-overview,
  body[data-role="student"][data-active="progress"] .progress-module-row,
  body[data-role="student"][data-active="progress"] .progress-sidebar {
    grid-template-columns: 1fr;
  }
}

/* Step 41: profile photo upload for student, teacher and admin */
.avatar.has-image {
  background: #eef4ef;
}

.avatar.has-image::after {
  display: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.profile-photo-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px 24px;
  align-items: center;
  margin-bottom: 16px;
  padding: 24px 28px;
}

.profile-photo-preview-wrap {
  display: grid;
  place-items: center;
  padding: 4px 8px 4px 4px;
}

.profile-photo-preview {
  width: 82px;
  height: 82px;
  border-width: 3px;
  box-shadow: 0 0 0 1px #d7ded9, 0 8px 24px rgba(13, 49, 31, .08);
}

.profile-photo-preview::after {
  font-size: 23px;
}

.profile-photo-copy {
  min-width: 0;
}

.profile-photo-copy h2 {
  margin: 0 0 10px;
}

.profile-photo-copy p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.profile-photo-copy small {
  display: block;
  margin-top: 2px;
  color: #6a756f;
  line-height: 1.45;
}

.profile-photo-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 170px;
  padding: 4px 0 4px 8px;
}

.profile-avatar-upload {
  width: 100%;
  text-align: center;
  cursor: pointer;
}

.profile-photo-actions .btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 900px) {
  .profile-photo-panel {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px 20px;
    gap: 18px;
  }

  .profile-photo-preview-wrap {
    padding: 0;
    justify-self: center;
  }

  .profile-photo-copy {
    padding: 0 4px;
  }

  .profile-photo-actions {
    min-width: 0;
    padding: 0;
    width: 100%;
    max-width: 320px;
    justify-self: center;
  }
}

/* Step 42: teacher students search + clearer next actions */
.teacher-actions-panel {
  display: grid;
  gap: 14px;
}
.teacher-action-row {
  align-items: center;
  gap: 18px;
}
.teacher-action-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.teacher-action-copy span,
.teacher-action-copy small {
  color: var(--muted);
  line-height: 1.35;
}
.teacher-action-copy span b {
  color: var(--ink);
}
.teacher-action-row .compact-actions {
  min-width: 280px;
  justify-content: flex-end;
}
@media (max-width: 900px) {
  .teacher-action-row {
    grid-template-columns: 1fr;
  }
  .teacher-action-row .compact-actions {
    min-width: 0;
    width: 100%;
    justify-content: stretch;
  }
  .teacher-action-row .compact-actions .btn {
    flex: 1 1 150px;
  }
}

/* Step 43: profile photo positioning for all accounts */
.avatar.has-image {
  --avatar-scale: 1;
  --avatar-x: 0%;
  --avatar-y: 0%;
}

.avatar.has-image img {
  transform: translate(var(--avatar-x), var(--avatar-y)) scale(var(--avatar-scale));
  transform-origin: center center;
  will-change: transform;
}

.profile-photo-actions {
  min-width: 190px;
}

.avatar-crop-backdrop {
  z-index: 80;
}

.avatar-crop-modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
}

.avatar-crop-stage {
  display: grid;
  place-items: center;
  padding: 22px 0 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f4faf5, #eef5f0);
  margin: 16px 0;
}

.avatar-crop-preview {
  width: 180px;
  height: 180px;
  border-width: 4px;
  box-shadow: 0 0 0 1px #d5ded8, 0 18px 40px rgba(13, 49, 31, .16);
}

.avatar-crop-preview::after {
  font-size: 38px;
}

.avatar-crop-controls {
  display: grid;
  gap: 14px;
}

.avatar-crop-controls label {
  display: grid;
  gap: 7px;
  font-weight: 800;
  color: var(--text);
}

.avatar-crop-controls label span {
  font-size: 13px;
}

.avatar-crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.avatar-crop-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  margin-top: 18px;
}

.avatar-crop-actions .btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 640px) {
  .avatar-crop-actions {
    grid-template-columns: 1fr;
  }
  .avatar-crop-preview {
    width: 150px;
    height: 150px;
  }
}

/* Step 45: global search results layout fixed across all roles/pages */
.top-search > span {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #151b22;
  font-size: 22px;
  pointer-events: none;
}

.global-search-popover {
  width: min(620px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 110px));
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 8px;
  padding: 12px;
  box-sizing: border-box;
}

.search-result-row {
  width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.search-result-row:hover,
.search-result-row:focus-visible {
  background: #f4faf5;
  border-color: rgba(34, 122, 55, .16);
  outline: none;
}

.search-result-badge {
  position: static !important;
  transform: none !important;
  align-self: start;
  width: 100%;
  max-width: 122px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(34, 122, 55, .10);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.search-result-content {
  position: static !important;
  transform: none !important;
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--text);
}

.search-result-content strong {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.search-result-content small {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.search-empty {
  margin: 0;
  padding: 12px 14px;
}

@media (max-width: 720px) {
  .global-search-popover {
    left: -56px;
    right: auto;
    width: calc(100vw - 28px);
  }

  .search-result-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .search-result-badge {
    width: auto;
    max-width: 100%;
    justify-self: start;
  }
}

/* Step 46: student plots actions and editable state */
.plot-filters-panel {
  margin-bottom: 18px;
}

.plot-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.plot-filter-grid .full-field {
  grid-column: 1 / -1;
}

.plot-edit-line input,
.plot-edit-line textarea,
.plot-create-modal input,
.plot-create-modal textarea,
.plot-create-modal select,
.plot-filters-panel input,
.plot-filters-panel select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.plot-edit-line textarea,
.plot-create-modal textarea {
  min-height: 92px;
  resize: vertical;
}

.plot-head .row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.plot-head .row-actions .btn,
.plot-head .row-actions .icon-btn {
  white-space: nowrap;
}

.plot-list .empty-state {
  padding: 18px;
}

.plot-create-modal .notice {
  margin-top: 14px;
}

@media (max-width: 1200px) {
  .plot-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .plot-filter-grid {
    grid-template-columns: 1fr;
  }
  .plot-head .row-actions {
    justify-content: stretch;
  }
  .plot-head .row-actions .btn,
  .plot-head .row-actions .icon-btn {
    width: 100%;
  }
}

/* Step 47: working plot screenshots and documents */
.screens .screen-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.screens .screen-thumb img {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 7px;
  object-fit: cover;
  display: block;
}

.screens .screen-thumb span {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: block;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(9, 22, 18, .72);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screens .screen-add {
  min-width: 0;
  cursor: pointer;
}

.doc-chips .plot-doc-chip {
  display: grid;
  gap: 2px;
  min-width: 190px;
  max-width: 260px;
  text-align: left;
  cursor: pointer;
}

.doc-chips .plot-doc-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plot-file-viewer {
  width: min(720px, 100%);
}

.plot-file-image-preview {
  display: grid;
  place-items: center;
  max-height: 58vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f6f8f6;
}

.plot-file-image-preview img {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.plot-doc-preview {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f6f8f6;
  text-align: center;
}

.large-doc-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #e7f2ea;
  color: var(--green);
  font-weight: 900;
}

@media (max-width: 760px) {
  .screens {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .doc-chips .plot-doc-chip,
  .doc-chips button {
    width: 100%;
    max-width: none;
  }
}

/* Step fix 2026-06-13: mentor home cards and groups layout */
body[data-role="mentor"][data-active="home"] .mentor-home-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

body[data-role="mentor"][data-active="home"] .mentor-home-kpis .kpi-card {
  min-height: 176px;
  padding: 20px;
  gap: 10px;
  align-content: stretch;
}

body[data-role="mentor"][data-active="home"] .mentor-home-kpis .kpi-card h3 {
  line-height: 1.18;
  margin: 0;
}

body[data-role="mentor"][data-active="home"] .mentor-home-kpis .kpi-card strong {
  font-size: 32px;
  line-height: 1;
}

body[data-role="mentor"][data-active="home"] .mentor-home-kpis .kpi-card span {
  line-height: 1.35;
}

body[data-role="mentor"][data-active="home"] .mentor-home-kpis .kpi-card .btn {
  width: 100%;
  min-height: 42px;
  margin-top: auto;
}

body[data-role="mentor"][data-active="home"] .mentor-groups-section {
  min-width: 0;
}

body[data-role="mentor"][data-active="home"] .mentor-section-title {
  margin-bottom: 10px;
  align-items: center;
}

body[data-role="mentor"][data-active="home"] .mentor-group-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

body[data-role="mentor"][data-active="home"] .mentor-group-card {
  min-width: 0;
  padding: 20px;
  gap: 16px;
}

body[data-role="mentor"][data-active="home"] .mentor-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

body[data-role="mentor"][data-active="home"] .mentor-group-title {
  min-width: 0;
}

body[data-role="mentor"][data-active="home"] .mentor-group-title h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

body[data-role="mentor"][data-active="home"] .mentor-group-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

body[data-role="mentor"][data-active="home"] .mentor-group-head .badge {
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}

body[data-role="mentor"][data-active="home"] .mentor-group-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body[data-role="mentor"][data-active="home"] .mentor-group-metrics span {
  min-height: 74px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

body[data-role="mentor"][data-active="home"] .mentor-group-metrics b {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

body[data-role="mentor"][data-active="home"] .mentor-group-metrics small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

body[data-role="mentor"][data-active="home"] .mentor-open-group {
  width: 100%;
  min-height: 44px;
}

@media (max-width: 1320px) {
  body[data-role="mentor"][data-active="home"] .mentor-group-grid,
  body[data-role="mentor"][data-active="home"] .mentor-home-kpis {
    grid-template-columns: 1fr;
  }
}

/* Step 50: mentor "Мои группы" cards and group detail spacing */
body[data-role="mentor"][data-active="groups"] .groups-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

body[data-role="mentor"][data-active="groups"] .main-column,
body[data-role="mentor"][data-active="groups"] .groups-grid,
body[data-role="mentor"][data-active="groups"] .group-detail {
  min-width: 0;
}

body[data-role="mentor"][data-active="groups"] .groups-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-bottom: 22px;
}

body[data-role="mentor"][data-active="groups"] .group-card {
  min-width: 0;
  padding: 20px;
  gap: 14px;
  align-content: start;
  overflow: visible;
}

body[data-role="mentor"][data-active="groups"] .group-card .section-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

body[data-role="mentor"][data-active="groups"] .group-card .section-title h2 {
  margin: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

body[data-role="mentor"][data-active="groups"] .group-card .badge {
  white-space: nowrap;
  align-self: start;
}

body[data-role="mentor"][data-active="groups"] .group-card p {
  line-height: 1.4;
  min-height: 40px;
}

body[data-role="mentor"][data-active="groups"] .group-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

body[data-role="mentor"][data-active="groups"] .group-meta span {
  min-width: 0;
  min-height: 64px;
  padding: 10px 12px;
  align-content: center;
  overflow: visible;
}

body[data-role="mentor"][data-active="groups"] .group-meta b {
  font-size: 16px;
  line-height: 1.12;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-role="mentor"][data-active="groups"] .group-meta .teacher b,
body[data-role="mentor"][data-active="groups"] .group-meta .curators b,
body[data-role="mentor"][data-active="groups"] .group-meta .course b {
  font-size: 15px;
}

body[data-role="mentor"][data-active="groups"] .group-actions .btn {
  width: 100%;
  min-height: 42px;
}

body[data-role="mentor"][data-active="groups"] .group-detail {
  padding: 20px;
  overflow: visible;
}

body[data-role="mentor"][data-active="groups"] .group-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}

body[data-role="mentor"][data-active="groups"] .group-summary span {
  min-height: 68px;
  padding: 12px 14px;
  align-content: center;
  overflow: visible;
}

body[data-role="mentor"][data-active="groups"] .group-summary b {
  line-height: 1.1;
}

body[data-role="mentor"][data-active="groups"] .group-next-call-hero {
  margin-top: 0;
  clear: both;
}

@media (max-width: 1380px) {
  body[data-role="mentor"][data-active="groups"] .groups-layout {
    grid-template-columns: 1fr;
  }

  body[data-role="mentor"][data-active="groups"] .right-rail {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 980px) {
  body[data-role="mentor"][data-active="groups"] .groups-grid,
  body[data-role="mentor"][data-active="groups"] .group-meta,
  body[data-role="mentor"][data-active="groups"] .group-summary {
    grid-template-columns: 1fr;
  }
}

