:root {
  --ink: #171b22;
  --muted: #6e737b;
  --soft: #f4f8f4;
  --soft-green: #eaf5ec;
  --line: #e1e6e2;
  --panel: #ffffff;
  --accent: #247338;
  --accent-hover: #1e5f30;
  --accent-2: #2e8b42;
  --accent-soft: rgba(36, 115, 56, .14);
  --accent-border: rgba(36, 115, 56, .35);
  --accent-dark: #0b1b1d;
  --accent-soft-light: #eaf5ec;
  --green: var(--accent);
  --green-dark: var(--accent-dark);
  --green-2: var(--accent-2);
  --amber: #f3a322;
  --blue: #2e78d6;
  --red: #e34c4c;
  --violet: #6b5ce7;
  --bg: #f7f8f7;
  --shadow: 0 18px 42px rgba(20, 36, 28, .07);
  --radius: 8px;
}

body[data-accent="green"] {
  --accent: #247338;
  --accent-hover: #1e5f30;
  --accent-2: #2e8b42;
  --accent-soft: rgba(36, 115, 56, .14);
  --accent-border: rgba(36, 115, 56, .35);
  --accent-dark: #0b1b1d;
  --accent-soft-light: #eaf5ec;
}

body[data-accent="luna"] {
  --accent: #54ACBF;
  --accent-hover: #26658C;
  --accent-2: #26658C;
  --accent-soft: rgba(84, 172, 191, .16);
  --accent-border: rgba(84, 172, 191, .38);
  --accent-dark: #023859;
  --accent-soft-light: #A7EBF2;
  --soft-green: #edf8fa;
}

body[data-accent="night"] {
  --accent: #5B8BC4;
  --accent-hover: #2E4A6E;
  --accent-2: #2E4A6E;
  --accent-soft: rgba(91, 139, 196, .16);
  --accent-border: rgba(91, 139, 196, .38);
  --accent-dark: #1A2940;
  --accent-soft-light: #A8C5E8;
  --soft-green: #eef3fa;
}

body[data-accent="graphite"] {
  --accent: #6B747C;
  --accent-hover: #434B52;
  --accent-2: #434B52;
  --accent-soft: rgba(107, 116, 124, .14);
  --accent-border: rgba(107, 116, 124, .34);
  --accent-dark: #2A3036;
  --accent-soft-light: #E8EAED;
  --soft-green: #f2f3f4;
}

body[data-accent="sand"] {
  --accent: #C4A574;
  --accent-hover: #8B6F47;
  --accent-2: #A68452;
  --accent-soft: rgba(196, 165, 116, .16);
  --accent-border: rgba(196, 165, 116, .38);
  --accent-dark: #5C4A32;
  --accent-soft-light: #F5EDE0;
  --soft-green: #faf6ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.landing {
  --landing-earth: #0d1812;
  --landing-earth-2: #14251c;
  --landing-earth-card: rgba(10, 24, 17, .48);
  --landing-earth-card-hover: rgba(14, 32, 22, .62);
  --landing-earth-border: rgba(143, 217, 160, .32);
  --landing-glass-highlight: rgba(255, 255, 255, .1);
  --landing-glow: rgba(143, 217, 160, .24);
  --landing-text: #f2fbf4;
  --landing-muted: rgba(214, 230, 218, .82);
  min-height: 100vh;
  color: var(--landing-text);
  background: var(--landing-earth);
  overflow-x: clip;
}

.landing.landing-reduced-motion *,
.landing.landing-reduced-motion *::before,
.landing.landing-reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .landing *,
  .landing *::before,
  .landing *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.landing-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.landing-atmosphere-body {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: .55;
}

.landing-depth-fog {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 18% 24%, rgba(143, 217, 160, .14), transparent 34%),
    radial-gradient(circle at 82% 72%, rgba(56, 115, 56, .16), transparent 38%),
    linear-gradient(180deg, rgba(8, 16, 12, .12), rgba(8, 16, 12, .42));
}

.landing-god-rays {
  position: absolute;
  inset: -28% -12%;
  background:
    conic-gradient(from 208deg at 74% -4%, rgba(255, 232, 170, .42) 0deg, transparent 24deg, transparent 360deg),
    linear-gradient(118deg, rgba(255, 236, 190, .24) 6%, transparent 38%),
    linear-gradient(138deg, rgba(180, 255, 200, .12) 0%, transparent 48%);
  mix-blend-mode: screen;
  filter: blur(8px);
  animation: landing-rays-shift 16s ease-in-out infinite alternate;
}

@keyframes landing-rays-shift {
  from { transform: translate3d(-1.5%, 0, 0) rotate(-1deg); opacity: .82; }
  to { transform: translate3d(1.5%, 1%, 0) rotate(1deg); opacity: 1; }
}

.landing-light-wash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 12%, rgba(255, 220, 150, .18), transparent 42%);
  mix-blend-mode: soft-light;
}

.landing-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 42%, rgba(4, 10, 8, .58) 100%);
}

.landing-sparks {
  position: absolute;
  inset: 0;
}

.landing-spark {
  position: absolute;
  left: var(--spark-left);
  top: var(--spark-top);
  width: var(--spark-size);
  height: var(--spark-size);
  border-radius: 50%;
  background: #b8f5c7;
  box-shadow: 0 0 14px rgba(184, 245, 199, .85);
  animation: landing-spark-float 5.5s ease-in-out infinite;
  animation-delay: var(--spark-delay);
  opacity: .75;
}

@keyframes landing-spark-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .45; }
  50% { transform: translate3d(0, -16px, 0) scale(1.25); opacity: .95; }
}

.landing-hero-layer {
  position: relative;
  z-index: 2;
}

.landing-hero-wrap {
  position: relative;
  overflow: hidden;
  min-height: min(100vh, 920px);
  background:
    linear-gradient(180deg, rgba(18, 28, 16, .22) 0%, rgba(12, 22, 16, .58) 55%, rgba(10, 18, 14, .82) 100%),
    var(--hero) center/cover;
  background-size: cover;
  color: #fff;
  animation: landing-hero-pan 30s ease-in-out infinite alternate;
}

@keyframes landing-hero-pan {
  from { background-position: center 44%; background-size: 104% auto; }
  to { background-position: center 56%; background-size: 111% auto; }
}

.landing-hero-item {
  animation: landing-fade-up .85s cubic-bezier(.22, 1, .36, 1) both;
}

.landing-hero-content > :nth-child(1) { animation-delay: .04s; }
.landing-hero-content > :nth-child(2) { animation-delay: .12s; }
.landing-hero-content > :nth-child(3) { animation-delay: .2s; }
.landing-hero-content > :nth-child(4) { animation-delay: .28s; }
.landing-hero-content > :nth-child(5) { animation-delay: .36s; }
.landing-hero-content > :nth-child(6) { animation-delay: .44s; }

@keyframes landing-fade-up {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 820px;
  margin-top: 28px;
}

.landing-stat {
  padding: 16px 18px;
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(145deg, rgba(255, 255, 255, .1), rgba(10, 24, 17, .42));
  border: 1px solid rgba(143, 217, 160, .28);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, .24),
    0 0 24px rgba(143, 217, 160, .12),
    inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px) saturate(1.2);
  transition: transform .25s ease, background .25s ease, box-shadow .25s ease;
}

.landing-stat:hover {
  transform: translateY(-4px);
  background: linear-gradient(145deg, rgba(255, 255, 255, .14), rgba(14, 32, 22, .52));
  box-shadow:
    0 22px 48px rgba(0, 0, 0, .28),
    0 0 32px rgba(143, 217, 160, .2),
    inset 0 1px 0 rgba(255, 255, 255, .16);
}

.landing-stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1;
  color: #fff;
}

.landing-stat span {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, .78);
}

.landing-ticker {
  overflow: hidden;
  background: linear-gradient(90deg, var(--accent-dark), color-mix(in srgb, var(--accent-dark) 80%, var(--accent)));
  border-block: 1px solid rgba(255, 255, 255, .08);
}

.landing-ticker-track {
  display: flex;
  width: max-content;
  gap: 0;
  padding: 13px 0;
  animation: landing-ticker-scroll 48s linear infinite;
}

.landing-ticker-track span {
  position: relative;
  padding: 0 30px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, .9);
}

.landing-ticker-track span::after {
  content: "◆";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: rgba(255, 255, 255, .35);
}

@keyframes landing-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.landing-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity .7s cubic-bezier(.22, 1, .36, 1) var(--reveal-delay, 0s),
    transform .7s cubic-bezier(.22, 1, .36, 1) var(--reveal-delay, 0s);
}

.landing-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.landing-section-lead {
  max-width: 720px;
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--landing-muted);
}

.landing-prose-wide {
  max-width: 860px;
}

.landing-topic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 20px;
  border-radius: var(--radius);
  transition: transform .22s ease, border-color .22s ease;
}

.landing-step:hover {
  transform: translateX(4px);
  border-color: rgba(118, 190, 132, .42);
}

.landing-step-marker {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
}

.landing-step strong {
  display: block;
  margin-bottom: 6px;
  font-size: 17px;
  line-height: 1.25;
}

.landing-step p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.landing-path-journey {
  display: grid;
  gap: 22px;
}

.landing-path-map-stage {
  position: relative;
  min-height: clamp(280px, 42vw, 430px);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid var(--landing-earth-border);
  box-shadow: 0 28px 60px rgba(0, 0, 0, .32);
  background: #0f1a15;
}

.landing-path-map-bg {
  position: absolute;
  inset: -8%;
  background:
    linear-gradient(180deg, rgba(10, 20, 15, .48), rgba(10, 20, 15, .78)),
    var(--map-img) center/cover;
  animation: landing-path-map-drift 24s ease-in-out infinite alternate;
}

@keyframes landing-path-map-drift {
  from { transform: scale(1.04) translate3d(-1.2%, 0, 0); }
  to { transform: scale(1.1) translate3d(1.2%, -1.5%, 0); }
}

.landing-path-map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(143, 217, 160, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 217, 160, .08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .45));
  pointer-events: none;
}

.landing-path-route-svg {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  min-height: clamp(280px, 42vw, 430px);
}

.landing-path-route-shadow,
.landing-path-route-base,
.landing-path-route-progress {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.landing-path-route-shadow {
  stroke: rgba(0, 0, 0, .38);
  stroke-width: 10;
  vector-effect: non-scaling-stroke;
}

.landing-path-route-base {
  stroke: rgba(143, 217, 160, .28);
  stroke-width: 5;
  stroke-dasharray: 10 12;
  vector-effect: non-scaling-stroke;
}

.landing-path-route-progress {
  stroke: #8fd9a0;
  stroke-width: 5;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  filter: drop-shadow(0 0 8px rgba(143, 217, 160, .45));
  vector-effect: non-scaling-stroke;
}

#landing-path:not(.is-playing) .landing-path-pin-pulse {
  animation-play-state: paused;
}

.landing-path-pin-pulse {
  fill: rgba(143, 217, 160, .18);
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.landing-path-pin.is-route-active .landing-path-pin-pulse {
  opacity: 1;
  animation: landing-path-pin-pulse 1.1s ease-out infinite;
}

@keyframes landing-path-pin-pulse {
  0% { transform: scale(.5); opacity: .9; }
  75% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

.landing-path-pin-dot {
  fill: #1d5c34;
  stroke: #fff;
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .22s ease, stroke .22s ease, fill .22s ease;
}

.landing-path-pin.is-route-active .landing-path-pin-dot {
  transform: scale(1.28);
  stroke: #8fd9a0;
  stroke-width: 4;
}

.landing-path-pin-start .landing-path-pin-dot {
  fill: #247338;
}

.landing-path-pin-end .landing-path-pin-dot {
  fill: #2e8b42;
}

.landing-path-pin-label {
  fill: #fff;
  font-size: 12px;
  font-weight: 800;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  pointer-events: none;
}

.landing-path-traveler-halo {
  fill: rgba(143, 217, 160, .22);
  stroke: rgba(143, 217, 160, .5);
  stroke-width: 2;
}

.landing-path-traveler-core {
  fill: #8fd9a0;
  stroke: #fff;
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(143, 217, 160, .65));
}

.landing-path-map-legend {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 16, 12, .72);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

.landing-path-legend-point {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .9);
  white-space: nowrap;
}

.landing-path-legend-a::before,
.landing-path-legend-b::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -1px;
}

.landing-path-legend-a::before {
  background: #247338;
  box-shadow: 0 0 0 2px #fff;
}

.landing-path-legend-b::before {
  background: #8fd9a0;
  box-shadow: 0 0 0 2px #fff;
}

.landing-path-legend-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, #247338, #8fd9a0);
  opacity: .85;
}

.landing-path-stops-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-path-stop-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--landing-earth-card);
  border: 1px solid var(--landing-earth-border);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .18);
  transition: transform .24s ease, border-color .24s ease, background .24s ease, box-shadow .24s ease;
}

.landing-path-stop-card:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 190, 132, .42);
  background: var(--landing-earth-card-hover);
}

.landing-path-stop-card.is-route-active {
  transform: scale(1.045);
  border-color: rgba(143, 217, 160, .72);
  background: linear-gradient(180deg, rgba(36, 115, 56, .22), rgba(14, 28, 21, .94));
  box-shadow:
    0 22px 44px rgba(56, 140, 78, .26),
    0 0 0 1px rgba(143, 217, 160, .18) inset;
  z-index: 1;
}

.landing-path-stop-card.is-route-active .landing-path-stop-num {
  background: rgba(143, 217, 160, .24);
  color: #d7f5de;
  transform: scale(1.08);
}

.landing-path-stop-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(56, 140, 78, .18);
  color: #8fd9a0;
  font-size: 15px;
  font-weight: 800;
  transition: transform .24s ease, background .24s ease, color .24s ease;
}

.landing-path-stop-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.25;
  color: var(--landing-text);
}

.landing-path-stop-card.is-route-active strong {
  color: #f2fbf4;
}

.landing-path-stop-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--landing-muted);
}

.landing-path-stop-card.is-route-active p {
  color: rgba(226, 240, 230, .9);
}

.landing-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.landing-insight {
  padding: 22px;
  border-radius: var(--radius);
  transition: transform .22s ease;
}

.landing-insight:hover {
  transform: translateY(-3px);
}

.landing-insight strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.landing-insight p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.landing-card {
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background .22s ease;
}

.landing-card:hover {
  transform: translateY(-3px);
  border-color: rgba(118, 190, 132, .42);
  background: var(--landing-earth-card-hover);
}

.landing-cta-inner {
  position: relative;
  overflow: hidden;
  animation: landing-cta-glow 8s ease-in-out infinite alternate;
}

.landing-cta-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(8, 18, 14, .82), rgba(12, 28, 20, .78)),
    var(--scene-mountains) center/cover;
  opacity: .42;
  z-index: 0;
}

.landing-cta-inner > * {
  position: relative;
  z-index: 1;
}

@keyframes landing-cta-glow {
  from { box-shadow: 0 18px 48px rgba(11, 27, 29, .18); }
  to { box-shadow: 0 22px 56px rgba(36, 115, 56, .22); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero-wrap,
  .landing-ticker-track,
  .landing-cta-inner,
  .landing-hero-item,
  .landing-about-visual,
  .landing-nature-panel,
  .landing-path-map-bg,
  .landing-god-rays,
  .landing-spark {
    animation: none !important;
  }

  [data-landing-parallax] {
    transform: none !important;
  }

  #landing-path.is-playing .landing-path-stop-card {
    animation: none;
  }

  .landing-path-stop-card.is-route-active {
    transform: none;
  }

  .landing-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.landing-hero-wrap header,
.landing-hero-wrap .hero {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.landing-hero-wrap header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
}

.landing-tagline {
  display: inline-block;
  margin: 0 0 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(10, 24, 17, .38));
  border: 1px solid rgba(143, 217, 160, .32);
  box-shadow: 0 0 24px rgba(143, 217, 160, .14);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .94);
}

.hero-lead {
  max-width: 720px;
  margin: 0 0 28px;
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.6;
  color: rgba(255, 255, 255, .9);
}

.landing-author-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  max-width: 820px;
  margin: 0 0 30px;
  padding: 20px 22px;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(145deg, rgba(255, 255, 255, .11), rgba(10, 24, 17, .46));
  border: 1px solid rgba(143, 217, 160, .34);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, .28),
    0 0 36px rgba(143, 217, 160, .14),
    inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px) saturate(1.25);
}

.landing-author-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(145deg, #38a84c, #154c2b);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .16);
}

.landing-author-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
  color: #fff;
}

.landing-author-card > div > span {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, .78);
}

.landing-author-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, .86);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-btn-ghost {
  color: #fff !important;
  border-color: rgba(255, 255, 255, .28) !important;
  background: rgba(255, 255, 255, .06) !important;
}

.landing-btn-ghost:hover {
  background: rgba(255, 255, 255, .12) !important;
}

.landing-nature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-height: 240px;
}

.landing-nature-panel {
  position: relative;
  min-height: 240px;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 16, 12, .15), rgba(8, 16, 12, .82)),
    var(--nature-img) center/cover;
  transition: background-size .6s ease;
  background-size: 108% auto;
}

.landing-nature-panel:hover {
  background-size: 115% auto;
}

.landing-nature-panel figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
  background: linear-gradient(0deg, rgba(6, 14, 10, .88), transparent);
}

.landing-body {
  position: relative;
  background:
    linear-gradient(180deg, rgba(14, 24, 18, .94), rgba(10, 18, 14, .98)),
    radial-gradient(circle at 20% 10%, rgba(255, 210, 140, .08), transparent 36%),
    radial-gradient(circle at 80% 88%, rgba(56, 110, 72, .12), transparent 34%);
}

.landing-body > .landing-section,
.landing-body > .landing-atmosphere + .landing-section {
  position: relative;
  z-index: 2;
}

.landing-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(56, 110, 72, .18), transparent 34%),
    radial-gradient(circle at 88% 72%, rgba(36, 78, 52, .16), transparent 30%);
  pointer-events: none;
}

.landing-about-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 28px;
  align-items: stretch;
}

.landing-about-visual {
  position: relative;
  min-height: 420px;
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid rgba(143, 217, 160, .34);
  background:
    linear-gradient(180deg, rgba(8, 16, 12, .08), rgba(8, 16, 12, .72)),
    var(--scene-visual) center/cover;
  box-shadow:
    0 28px 64px rgba(0, 0, 0, .34),
    0 0 36px rgba(143, 217, 160, .16);
  animation: landing-visual-breathe 18s ease-in-out infinite alternate;
}

@keyframes landing-visual-breathe {
  from { background-size: 108% auto; background-position: center 42%; }
  to { background-size: 116% auto; background-position: center 58%; }
}

.landing-visual-badge {
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 16, 12, .72);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .9);
}

.landing-section-alt::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, rgba(10, 22, 16, .86), rgba(12, 26, 19, .82)),
    var(--section-scene, var(--scene-forest)) center/cover;
  z-index: 0;
}

.landing-section-scene-forest { --section-scene: var(--scene-forest); }
.landing-section-scene-mountains { --section-scene: var(--scene-mountains); }
.landing-section-scene-land { --section-scene: var(--scene-land); }
.landing-section-scene-hills { --section-scene: var(--scene-hills); }

.landing-section-scene-land::after,
.landing-section-scene-mountains::after {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(12, 22, 17, .94), rgba(12, 22, 17, .72)),
    var(--section-scene) center/cover;
  opacity: .22;
  z-index: 0;
  pointer-events: none;
}

.landing-section {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 64px 0;
}

.landing-section-alt {
  position: relative;
}

.landing-section-alt > * {
  position: relative;
  z-index: 1;
}

.landing-section-head {
  margin-bottom: 24px;
}

.landing-section-head h2 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--landing-text);
}

.landing-prose {
  max-width: 760px;
}

.landing-prose p {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--landing-muted);
}

.landing-prose p:last-child {
  margin-bottom: 0;
}

.landing-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.landing-checklist li {
  position: relative;
  padding-left: 22px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--landing-text);
}

.landing-topic-num {
  position: absolute;
  left: 18px;
  top: 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #8fd9a0;
}

.landing-checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.landing-card-grid {
  display: grid;
  gap: 16px;
}

.landing-card-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.landing-feature-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.landing-topic-card {
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--radius) + 2px);
  background: var(--landing-earth-card);
  border: 1px solid var(--landing-earth-border);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .22);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.landing-topic-card:hover {
  transform: translateY(-4px);
  border-color: rgba(118, 190, 132, .42);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .28);
}

.landing-topic-visual {
  height: 132px;
  background:
    linear-gradient(180deg, rgba(8, 16, 12, .04), rgba(8, 16, 12, .72)),
    var(--topic-visual) center/cover;
  transition: transform .45s ease;
}

.landing-topic-card:hover .landing-topic-visual {
  transform: scale(1.05);
}

.landing-topic-body {
  position: relative;
  padding: 20px 22px 22px 58px;
}

.landing-topic-card h3,
.landing-card h3,
.landing-feature-card h3,
.landing-step strong,
.landing-insight strong {
  color: var(--landing-text);
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.25;
}

.landing-topic-card p,
.landing-card p,
.landing-feature-card p,
.landing-step p,
.landing-insight p {
  color: var(--landing-muted);
}

.landing-card,
.landing-feature-card,
.landing-step,
.landing-insight,
.landing-topic-card,
.landing-audience-card,
.landing-path-stop-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, .1), var(--landing-earth-card));
  border: 1px solid var(--landing-earth-border);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, .28),
    0 0 28px var(--landing-glow),
    inset 0 1px 0 var(--landing-glass-highlight);
  backdrop-filter: blur(16px) saturate(1.22);
}

.landing-path-map-stage {
  border: 1px solid rgba(143, 217, 160, .34);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, .32),
    0 0 36px rgba(143, 217, 160, .14);
}

.landing-audience-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.landing-audience-visual {
  flex: 0 0 112px;
  height: 112px;
  background:
    linear-gradient(180deg, rgba(8, 16, 12, .08), rgba(8, 16, 12, .72)),
    var(--card-visual) center/cover;
  transition: transform .45s ease;
}

.landing-audience-card:hover .landing-audience-visual {
  transform: scale(1.04);
}

.landing-audience-body {
  padding: 20px 22px 22px;
}

.landing-audience-body h3 {
  margin: 0 0 10px;
}

.landing-audience-body p {
  margin: 0;
}

.landing-insight {
  background: linear-gradient(180deg, rgba(143, 217, 160, .14), rgba(10, 24, 17, .52));
}

.landing-card:hover,
.landing-feature-card:hover,
.landing-topic-card:hover,
.landing-audience-card:hover,
.landing-step:hover {
  border-color: rgba(143, 217, 160, .52);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, .32),
    0 0 40px rgba(143, 217, 160, .26),
    inset 0 1px 0 rgba(255, 255, 255, .16);
}

.landing-feature-icon,
.landing-step-marker {
  background: rgba(56, 140, 78, .18);
  color: #8fd9a0;
}

.landing-card,
.landing-feature-card {
  min-height: 132px;
  padding: 22px;
  border-radius: var(--radius);
  text-align: left;
}

.landing-feature-card {
  display: grid;
  gap: 8px;
  width: 100%;
  appearance: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.landing-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 190, 132, .42);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
  background: var(--landing-earth-card-hover);
}

.landing-card:hover {
  background: var(--landing-earth-card-hover);
}

.landing-feature-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  transition: transform .25s ease;
}

.landing-feature-card:hover .landing-feature-icon {
  transform: scale(1.08) rotate(-4deg);
}

.landing-cta {
  padding-bottom: 80px;
}

.landing-cta-inner {
  padding: 42px 28px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(10, 28, 18, .72));
  border: 1px solid rgba(143, 217, 160, .34);
  color: #fff;
  text-align: center;
  box-shadow:
    0 28px 64px rgba(0, 0, 0, .34),
    0 0 42px rgba(143, 217, 160, .18);
  backdrop-filter: blur(14px) saturate(1.2);
}

.landing-cta-inner h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  color: #fff;
}

.landing-cta-inner p {
  max-width: 640px;
  margin: 0 auto 24px;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .86);
}

.landing-cta-actions {
  justify-content: center;
}

.landing-btn-ghost-light {
  color: #fff !important;
  border-color: rgba(255, 255, 255, .28) !important;
  background: rgba(255, 255, 255, .08) !important;
}

@media (max-width: 1024px) {
  .landing-card-grid-4,
  .landing-topic-grid,
  .landing-insight-grid,
  .landing-path-stops-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .landing-hero-wrap header {
    flex-direction: column;
    align-items: flex-start;
  }

  .landing-hero-wrap .nav-links {
    width: 100%;
  }

  .landing-author-card {
    grid-template-columns: 1fr;
  }

  .landing-about-split {
    grid-template-columns: 1fr;
  }

  .landing-about-visual {
    min-height: 260px;
  }

  .landing-nature-strip {
    grid-template-columns: 1fr;
  }

  .landing-nature-panel {
    min-height: 180px;
  }

  .landing-section {
    padding: 48px 0;
  }

  .landing-card-grid-4,
  .landing-checklist,
  .landing-topic-grid,
  .landing-steps,
  .landing-path-stops-list,
  .landing-insight-grid,
  .landing-hero-stats {
    grid-template-columns: 1fr;
  }

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 16px 16px 22px 22px;
  background: linear-gradient(145deg, #38a84c, #154c2b);
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.18);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 10px;
  width: 28px;
  height: 18px;
  background: #f7faf8;
  clip-path: polygon(0 100%, 30% 30%, 54% 58%, 75% 0, 100% 100%);
}

.brand-mark .ridge {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 10px;
  height: 16px;
  border: 3px solid rgba(5, 30, 14, .72);
  border-top: 0;
  border-radius: 0 0 32px 32px;
  transform: rotate(10deg);
}

.brand-mark .leaf {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 20px;
  height: 10px;
  background: #7bd36f;
  border-radius: 20px 0 20px 0;
  transform: rotate(-8deg);
}

.brand-text {
  display: grid;
  line-height: 1;
}

.brand-text small {
  font-size: 12px;
  letter-spacing: 1.8px;
  color: rgba(255,255,255,.9);
}

.brand-text strong {
  font-size: 34px;
  letter-spacing: 0;
  color: #fff;
}

.brand-text em {
  font-style: normal;
  color: #45b854;
  font-size: 15px;
  justify-self: end;
}

.nav-links, .row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links button {
  border: 0;
  background: transparent;
  color: #fff;
}

.hero {
  min-height: 70vh;
  display: grid;
  align-content: center;
  padding: 42px 0 86px;
}

.landing-hero-wrap .hero h1 {
  max-width: 820px;
  margin: 0 0 18px;
  font-size: clamp(32px, 4.8vw, 56px);
  line-height: 1.08;
}

.hero h1 {
  max-width: 780px;
  margin: 0 0 18px;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.02;
}

.hero p {
  max-width: 690px;
  margin: 0 0 28px;
  font-size: 20px;
  line-height: 1.55;
  color: rgba(255,255,255,.9);
}

.public-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-bottom: 40px;
}

.public-card {
  min-height: 132px;
  padding: 22px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  color: var(--ink);
}

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 18px;
  background: linear-gradient(color-mix(in srgb, var(--accent-2) 88%, white), var(--accent));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset;
}

.btn.secondary {
  background: #fff;
  color: var(--green);
  border-color: var(--line);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--green);
  border-color: var(--line);
  box-shadow: none;
}

.btn.dark {
  background: rgba(8, 17, 18, .72);
  border-color: rgba(255,255,255,.32);
}

.btn.full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.link-btn, .section-title button, .link-wide {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
}

.link-wide {
  width: 100%;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.login-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
  background: rgba(6, 19, 18, .68);
}

.login-card {
  width: min(460px, 100%);
  padding: 26px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 7px;
  margin: 13px 0;
}

.field label {
  color: #303944;
  font-weight: 700;
  font-size: 13px;
}

.field input, .field select, .field textarea, .search, .top-search input, .filters input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
}

.field textarea { min-height: 94px; resize: vertical; }

.course-modal .field.field-invalid label,
.lesson-modal .field.field-invalid label {
  color: #b42318;
}

.course-modal .field.field-invalid input,
.course-modal .field.field-invalid select,
.course-modal .field.field-invalid textarea,
.lesson-modal .field.field-invalid input,
.lesson-modal .field.field-invalid select,
.lesson-modal .field.field-invalid textarea {
  border-color: #d92d20;
  box-shadow: 0 0 0 1px rgba(217, 45, 32, 0.12);
}

.course-modal .field-error-note,
.lesson-modal .field-error-note,
.topic-modal .field-error-note {
  display: block;
  margin-top: 4px;
  color: #b42318;
  font-size: 12px;
}

body[data-theme="dark"] .course-modal .field.field-invalid label,
body[data-theme="dark"] .course-modal .field-error-note,
body[data-theme="dark"] .lesson-modal .field.field-invalid label,
body[data-theme="dark"] .lesson-modal .field-error-note,
body[data-theme="dark"] .topic-modal .field.field-invalid label,
body[data-theme="dark"] .topic-modal .field-error-note,
body[data-theme="dark"] .topic-form-error-note {
  color: #ff8a80;
}

body[data-theme="dark"] .course-modal .field.field-invalid input,
body[data-theme="dark"] .course-modal .field.field-invalid select,
body[data-theme="dark"] .course-modal .field.field-invalid textarea,
body[data-theme="dark"] .lesson-modal .field.field-invalid input,
body[data-theme="dark"] .lesson-modal .field.field-invalid select,
body[data-theme="dark"] .lesson-modal .field.field-invalid textarea,
body[data-theme="dark"] .topic-modal .field.field-invalid input,
body[data-theme="dark"] .topic-modal .field.field-invalid select,
body[data-theme="dark"] .topic-modal .field.field-invalid textarea {
  border-color: rgba(255, 138, 128, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 138, 128, 0.18);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.shell.compact-sidebar {
  grid-template-columns: 88px minmax(0, 1fr);
}

.shell.compact-sidebar .sidebar {
  padding: 18px 10px;
}

.shell.compact-sidebar .brand-text,
.shell.compact-sidebar .role-switch,
.shell.compact-sidebar .help-card {
  display: none;
}

.shell.compact-sidebar .brand {
  margin-bottom: 8px;
}

.shell.compact-sidebar .menu button {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 12px 8px;
}

.shell.compact-sidebar .menu button span:not(.icon),
.shell.compact-sidebar .menu-dot {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding: 22px 14px 18px;
  background:
    radial-gradient(circle at 65% 8%, rgba(43, 130, 65, .22), transparent 26%),
    linear-gradient(180deg, #071315, #0b1b1e 56%, #071214);
  color: #edf5ef;
}

.sidebar .brand {
  justify-content: center;
  margin: 0 4px 6px;
}

.role-switch { padding: 0 8px; }
.role-switch select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  color: #dce9df;
  background: rgba(255,255,255,.06);
  padding: 9px 10px;
}

.role-note {
  display: block;
  margin-top: 8px;
  color: rgba(255,255,255,.62);
  font-size: 12px;
}

.role-switch-locked {
  display: grid;
  gap: 6px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #eef6f0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.login-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f0;
  color: #9f2d1f;
  font-size: 13px;
  font-weight: 700;
}

.login-hints {
  display: grid;
  gap: 4px;
  margin: 8px 0 14px;
  padding: 12px;
  border-radius: 10px;
  background: #f6faf7;
  font-size: 13px;
}

.login-hints p {
  margin: 0;
}

/* Окно входа на лендинге — всегда светлое и читаемое, даже если включена тёмная тема */
.login-panel .login-card,
body[data-theme="dark"] .login-panel .login-card {
  background: #fff !important;
  color: #1a2520 !important;
  border: 1px solid rgba(0, 0, 0, .06) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28) !important;
}

.login-panel .login-card :where(h2, h3, strong, b),
body[data-theme="dark"] .login-panel .login-card :where(h2, h3, strong, b) {
  color: #0f1a14 !important;
}

.login-panel .login-card :where(p, label),
body[data-theme="dark"] .login-panel .login-card :where(p, label) {
  color: #303944 !important;
}

.login-panel .login-card .field input,
body[data-theme="dark"] .login-panel .login-card .field input {
  background: #fff !important;
  color: #1a2520 !important;
  border-color: #d5e0d8 !important;
}

.login-panel .login-card .field input::placeholder,
body[data-theme="dark"] .login-panel .login-card .field input::placeholder {
  color: #8a968f !important;
}

.login-panel .login-hints,
body[data-theme="dark"] .login-panel .login-hints {
  background: #f3f8f4 !important;
  border: 1px solid #e2ece4 !important;
}

.login-panel .login-hints :where(p, .muted),
body[data-theme="dark"] .login-panel .login-hints :where(p, .muted) {
  color: #4a5c52 !important;
}

.login-panel .login-error,
body[data-theme="dark"] .login-panel .login-error {
  background: #fff1f0 !important;
  color: #9f2d1f !important;
  border: 1px solid #f5c2be !important;
}

.login-panel .btn.ghost,
body[data-theme="dark"] .login-panel .btn.ghost {
  background: #fff !important;
  color: #247338 !important;
  border-color: #c9d9ce !important;
}

.activity-page-layout .activity-group {
  margin-top: 14px;
}

.activity-event-card {
  cursor: default;
}

.menu {
  display: grid;
  gap: 7px;
}

.menu button {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(255,255,255,.92);
  text-align: left;
  font-weight: 650;
}

.menu button.active, .menu button:hover {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-2) 78%, transparent), color-mix(in srgb, var(--accent) 66%, transparent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.menu .icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 6px;
  font-size: 14px;
}

.menu-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f04d4d;
  color: #fff;
  font-size: 11px;
}

.help-card {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  box-shadow: 0 16px 42px rgba(0,0,0,.16);
}

.help-card span { color: rgba(255,255,255,.82); line-height: 1.45; }

.help-card strong {
  font-size: 17px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: 68px 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(320px, 520px) auto auto;
  justify-content: end;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
}

.hamburger, .top-icon, .icon-btn, .round-btn {
  border: 0;
  background: transparent;
  color: #1f2831;
}

.hamburger {
  justify-self: start;
  margin-right: auto;
  width: 38px;
  height: 38px;
  font-size: 21px;
}

.top-search {
  position: relative;
}

.top-search span {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #151b22;
  font-size: 22px;
}

.global-search-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 94;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 28, 22, .18);
}

.search-result-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 10px;
  color: inherit;
  text-align: left;
}

.search-result-row:hover {
  background: #eef7ef;
}

.search-result-row span {
  position: static;
  transform: none;
  grid-row: span 2;
  width: auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.search-result-row strong,
.search-result-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.search-result-row small {
  color: var(--muted);
}

.top-icon {
  position: relative;
  width: 42px;
  height: 42px;
  font-size: 24px;
}

.top-icon span {
  position: absolute;
  right: 2px;
  top: 4px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ee4b4b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.notification-popover {
  position: absolute;
  top: 58px;
  right: 96px;
  z-index: 90;
  width: min(390px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 28, 22, .18);
}

.notification-popover .section-title {
  margin-bottom: 10px;
}

.notification-popover h2 {
  margin: 0;
  font-size: 18px;
}

.mini-notice-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.mini-notice-list button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f3f8f4;
  padding: 10px;
  color: inherit;
  text-align: left;
}

.mini-notice-list button.read {
  background: #fff;
  border-color: var(--line);
}

.mini-notice-list span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--soft-green);
  color: var(--green);
  font-weight: 900;
}

.mini-notice-list strong {
  min-width: 0;
  font-size: 13px;
}

.mini-notice-list small {
  color: var(--muted);
  white-space: nowrap;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 4px;
  border-radius: 8px;
}

.profile-chip:hover {
  background: #f2f6f3;
}

.profile-chip span:first-child {
  display: grid;
  gap: 2px;
  text-align: right;
}

.profile-chip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-menu {
  position: absolute;
  top: 58px;
  right: 28px;
  z-index: 92;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 28, 22, .18);
}

.profile-menu button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 11px 12px;
  color: #202830;
  text-align: left;
  font-weight: 800;
}

.profile-menu button:hover {
  background: #eef7ef;
  color: var(--green);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, #f1b88d 0 22%, transparent 23%),
    radial-gradient(circle at 50% 47%, #312118 0 21%, transparent 22%),
    linear-gradient(#d9e6dc, #b8c9bc);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d7ded9;
}

.small-avatar { width: 30px; height: 30px; }

.content {
  width: min(1600px, 100%);
  padding: 24px 32px 34px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.15;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 1px rgba(18, 27, 22, .02);
}

.panel h2, .panel h3 { margin-top: 0; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.main-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.right-rail {
  display: grid;
  gap: 14px;
}

.right-rail .panel {
  padding: 18px;
}

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

.kpi-card {
  min-height: 250px;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.kpi-card strong {
  font-size: 34px;
}

.kpi-card small {
  font-size: 17px;
}

.kpi-card span, .kpi-card p, .muted {
  color: var(--muted);
}

.status-medal {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 4px solid #d5e8d8;
  border-radius: 18px;
  color: var(--green);
  font-size: 30px;
}

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

.progress span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.mini-chart {
  height: 84px;
  display: flex;
  align-items: end;
  gap: 14px;
  padding-top: 16px;
}

.mini-chart i {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(#2f8a42, rgba(47,138,66,.08));
}

.home-community-kpi .home-community-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-community-kpi .home-community-head h3 {
  margin: 0;
}

.home-community-kpi .rail-topic:first-of-type {
  padding-top: 0;
}

.home-community-kpi .rail-topic:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.home-community-kpi .home-community-topic {
  display: grid;
  gap: 6px;
}

.home-community-kpi button.home-community-topic-open {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  padding: 0;
}

.home-community-kpi button.home-community-topic-open:hover p {
  color: var(--green);
}

.home-community-topic-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.home-community-topic-heart {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.home-community-topic-heart:hover,
.home-community-topic-heart:focus-visible {
  color: #e11d48;
}

.home-community-topic-heart.is-active {
  color: #e11d48;
}

.home-community-topic-heart:active {
  transform: scale(0.94);
}

.home-community-topic-replies {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.home-community-topic-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.event-hero {
  min-height: 190px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 24px;
  border-radius: var(--radius);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(6, 18, 20, .92), rgba(6, 18, 20, .68)),
    var(--bg) center/cover;
  overflow: hidden;
}

.event-hero h2 {
  margin: 6px 0 14px;
  font-size: 24px;
}

.hero-label {
  display: inline-flex;
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(47,138,66,.85);
  color: #fff;
  font-weight: 800;
}

.telemost-badge {
  width: 82px;
  height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: #fff;
  color: #e32323;
  line-height: 1;
}

.telemost-badge strong {
  display: block;
  margin-top: -2px;
  color: #e32323;
  font-size: 34px;
  font-weight: 900;
  line-height: .92;
}

.telemost-badge small {
  display: block;
  margin-top: 6px;
  color: #0f1719;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
}

.lesson-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.lesson-card {
  min-height: 150px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(rgba(5, 18, 19, .15), rgba(5, 18, 19, .78)), var(--bg) center/cover;
  overflow: hidden;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}

.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 36, 28, .18);
}

.lesson-card span {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.22);
}

.lesson-card strong { font-size: 17px; }
.lesson-card small { color: rgba(255,255,255,.86); }

.home-continue-learning {
  display: grid;
  gap: 16px;
}

.home-course-card-list {
  display: grid;
  gap: 18px;
}

.home-course-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 0 rgba(20, 36, 28, .03);
}

.home-course-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfb 0%, #fff 100%);
}

.home-course-card-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.home-course-card-progress {
  flex: 0 0 168px;
  width: 168px;
  max-width: 42%;
  text-align: right;
}

.home-course-card-progress-value {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.home-course-card-progress .progress {
  width: 100%;
  margin: 0;
}

.home-course-card-body {
  padding: 18px 20px;
  min-height: 132px;
}

.home-course-card-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.home-course-card-modules .lesson-card {
  min-height: 136px;
}

.home-course-card-more,
.home-course-card-empty {
  margin: 12px 0 0;
}

.home-course-card-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: #f8faf8;
}

.home-course-card-footer .btn {
  flex: 1 1 0;
  min-width: 140px;
  justify-content: center;
}

@media (max-width: 760px) {
  .home-course-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .home-course-card-progress {
    width: 100%;
    max-width: none;
    text-align: left;
  }

  .home-course-card-footer {
    flex-direction: column;
  }

  .home-course-card-footer .btn {
    width: 100%;
  }
}

body[data-theme="dark"] .home-course-card {
  background: var(--dark-card-readable) !important;
  border-color: var(--dark-readable-border) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset;
}

body[data-theme="dark"] .home-course-card-head {
  background: linear-gradient(180deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .02) 100%) !important;
  border-bottom-color: var(--dark-readable-border) !important;
}

body[data-theme="dark"] .home-course-card-title {
  color: var(--dark-readable-text) !important;
}

body[data-theme="dark"] .home-course-card-footer {
  background: rgba(255, 255, 255, .025) !important;
  border-top-color: var(--dark-readable-border) !important;
}

.lesson-card.locked {
  opacity: .72;
  cursor: not-allowed;
}

.lesson-card .module-card-status {
  font-style: normal;
  font-size: 12px;
  color: rgba(255,255,255,.88);
}

.module-detail-hero {
  min-height: 260px;
  display: grid;
  align-items: end;
  padding: 26px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(6,18,20,.9), rgba(6,18,20,.48)),
    var(--bg) center/cover;
  overflow: hidden;
}

.module-detail-hero h2 {
  margin: 14px 0 8px;
  font-size: 34px;
}

.module-detail-hero p {
  max-width: 720px;
  color: rgba(255,255,255,.86);
  line-height: 1.5;
}

.module-detail-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.module-detail-stats span {
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.82);
}

.module-detail-stats b {
  display: block;
  color: #fff;
  font-size: 20px;
}

.module-task {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px;
}

.module-task p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.two-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.two-panels .panel, .table-panel, .task-panel, .submit-panel, .homework-hero, .profile-form, .support-form {
  padding: 18px;
}

.compact-row, .rail-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}

.compact-row.action-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 0;
}

.rail-row.action-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  background: transparent;
  color: inherit;
  text-align: left;
}

.compact-row.action-row:hover, .rail-row.action-row:hover {
  margin-left: -10px;
  margin-right: -10px;
  padding-left: 10px;
  padding-right: 10px;
  border-radius: 8px;
  background: #f3f8f4;
}

.compact-row:last-child, .rail-row:last-child { border-bottom: 0; }

.compact-row strong, .rail-row strong {
  display: block;
  margin-bottom: 4px;
}

.compact-row span, .rail-row small {
  color: var(--muted);
  font-size: 13px;
}

.rail-row {
  grid-template-columns: 36px 1fr;
}

.rail-row img {
  width: 58px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
}

.rail-topic {
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}

.rail-topic p {
  margin: 6px 0;
  line-height: 1.4;
}

.ring {
  --size: 112px;
  position: relative;
  width: var(--size);
  height: var(--size);
  margin: 4px auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #fff 70%, transparent 71%),
    conic-gradient(var(--green) calc(var(--p) * 1%), #e7ebe7 0);
}

.ring strong {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  line-height: 1;
  z-index: 1;
}

.ring span {
  position: absolute;
  left: 50%;
  top: 39%;
  transform: translate(-50%, -50%);
  width: 76%;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  z-index: 1;
}

.centered {
  text-align: center;
}

.legend {
  display: grid;
  gap: 10px;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
}

.legend span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.tabs, .category-pills, .course-tabs, .filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tabs button, .category-pills button, .course-tabs button, .filter {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #343b43;
  padding: 8px 14px;
}

.tabs button.active, .category-pills button.active, .course-tabs button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.course-tabs span {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.32);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 180px 180px;
}

.course-hero {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 270px;
  gap: 24px;
  padding: 18px;
  align-items: center;
}

.course-hero img {
  height: 170px;
  width: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.course-hero h2 {
  margin: 0 0 12px;
  font-size: 24px;
}

.course-hero strong {
  display: block;
  margin: 8px 0;
  font-size: 29px;
}

.course-meta {
  display: grid;
  gap: 16px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.course-meta span {
  color: var(--muted);
  line-height: 1.45;
}

.course-meta b {
  color: var(--ink);
}

.block-title {
  margin: 4px 0 0;
  font-size: 20px;
}

.program-list {
  display: grid;
  gap: 12px;
}

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

.program-module.expanded {
  background: linear-gradient(90deg, rgba(46, 139, 66, .06), #fff 28%);
}

.module-summary, .lesson-module-head {
  display: grid;
  grid-template-columns: 42px 1fr 210px 120px 42px;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.module-num, .lesson-ring {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.lesson-ring {
  width: 54px;
  height: 54px;
  background: var(--soft-green);
  color: var(--green);
  border: 3px solid var(--green);
}

.module-summary h3, .lesson-module-head h2 {
  margin: 0 0 6px;
}

.module-summary p, .lesson-module-head p {
  margin: 0;
  color: var(--muted);
}

.module-stat {
  display: grid;
  gap: 6px;
}

.module-stat span {
  color: var(--muted);
  font-size: 13px;
}

.module-lessons {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.62);
}

.lesson-line {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 150px 150px;
  gap: 14px;
  align-items: center;
  padding: 13px 22px;
  border-bottom: 1px solid #edf0ed;
}

.lesson-line:last-child { border-bottom: 0; }
.lesson-line.current { background: linear-gradient(90deg, rgba(46,139,66,.09), transparent); }
.lesson-line span { color: var(--green); font-weight: 800; }
.lesson-line em { font-style: normal; color: var(--green); font-weight: 700; }
.lesson-line small { display: block; color: var(--muted); margin-top: 4px; }
.lesson-line.task { background: #fbfdfb; }

.lesson-module {
  overflow: hidden;
}

.lesson-module.open {
  border-color: rgba(36,115,56,.45);
}

.lesson-admin-filters {
  display: grid;
  grid-template-columns: 1.15fr 1.3fr .95fr 1fr minmax(220px, 1.35fr);
  gap: 10px;
  margin-bottom: 16px;
}

.admin-lessons-panel {
  overflow: hidden;
}

.admin-lesson-list {
  display: grid;
}

.admin-lesson-row {
  display: grid;
  grid-template-columns: 96px minmax(230px, 1fr) 116px 98px 138px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.admin-lesson-row:first-child {
  border-top: 0;
}

.admin-lesson-row:hover,
.admin-lesson-row.selected {
  background: linear-gradient(90deg, rgba(46,139,66,.08), transparent);
}

.admin-lesson-row.selected {
  box-shadow: inset 3px 0 0 var(--green);
}

.admin-lesson-row small,
.admin-lesson-row span {
  color: var(--muted);
}

.admin-lesson-row b,
.admin-lesson-title strong {
  color: var(--ink);
}

.admin-lesson-title {
  min-width: 0;
}

.admin-lesson-title strong,
.admin-lesson-title small {
  display: block;
  overflow-wrap: anywhere;
}

.lesson-bits {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.admin-lesson-row .lesson-bits {
  grid-column: 2 / span 2;
  grid-template-columns: repeat(3, max-content);
}

.admin-lesson-date {
  justify-self: end;
}

.admin-lesson-row .row-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.lesson-bits.vertical {
  margin-top: 10px;
}

.selected-lesson-info {
  display: grid;
  gap: 9px;
}

.selected-lesson-info > span,
.selected-lesson-info p {
  margin: 0;
  color: var(--muted);
}

.lesson-modal,
.lesson-editor-modal {
  width: min(1040px, calc(100vw - 28px));
}

.lesson-editor-tabs {
  margin: 6px 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-editor-tabs .tabs {
  flex-wrap: wrap;
}

.lesson-editor-section {
  display: grid;
  gap: 14px;
}

.lesson-editor-section textarea,
.lesson-editor-modal textarea {
  min-height: 150px;
}

.lesson-content-editor {
  min-height: 220px;
}

.lesson-rich-editor-wrap {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.lesson-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.lesson-rich-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #d7e0da;
  border-radius: 6px;
  background: #fff;
  color: #2f3a34;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.lesson-rich-btn:hover {
  border-color: #9eb5a4;
  background: #f3f8f4;
}

.lesson-rich-btn.is-active {
  border-color: var(--green);
  background: #e8f5ec;
  color: var(--green);
}

.lesson-rich-area {
  min-height: 200px;
  max-height: 480px;
  padding: 12px 14px;
  overflow: auto;
  resize: vertical;
  line-height: 1.65;
  color: #243029;
  outline: none;
}

.lesson-rich-area:empty::before {
  content: attr(data-placeholder);
  color: #8a968f;
  pointer-events: none;
}

.lesson-rich-area:focus {
  box-shadow: inset 0 0 0 1px rgba(47, 111, 78, 0.18);
}

.lesson-formatted-content,
.lesson-view-content .lesson-formatted-content {
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lesson-formatted-content h2,
.lesson-rich-area h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
}

.lesson-formatted-content h3,
.lesson-rich-area h3,
.lesson-block-heading {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
}

.lesson-formatted-content p,
.lesson-rich-area p {
  margin: 0;
}

.lesson-formatted-content ul,
.lesson-formatted-content ol,
.lesson-rich-area ul,
.lesson-rich-area ol {
  margin: 0;
  padding-left: 1.35rem;
}

.lesson-formatted-content li,
.lesson-rich-area li {
  margin: 0.2rem 0;
}

.lesson-formatted-content blockquote,
.lesson-rich-area blockquote {
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid #d4a64a;
  border-radius: 0 8px 8px 0;
  background: #fff8e8;
}

.lesson-view-panel {
  display: grid;
  gap: 18px;
}

.lesson-view-content {
  margin-top: 4px;
}

.lesson-video-card {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.lesson-video-link {
  overflow-wrap: anywhere;
}

.lesson-meta-list {
  display: grid;
  gap: 12px;
}

.lesson-meta-list span {
  display: block;
  color: #66716a;
  font-size: 13px;
}

.lesson-meta-list b {
  display: block;
  margin-top: 4px;
  color: #243029;
  font-size: 15px;
}

@media (max-width: 720px) {
  .lesson-rich-toolbar {
    gap: 6px 4px;
  }

  .lesson-rich-btn {
    min-width: 28px;
    height: 26px;
    font-size: 11px;
  }
}

.lesson-content-body {
  display: grid;
  gap: 12px;
}

.lesson-content-body p {
  margin: 0;
  line-height: 1.65;
}

.lesson-content-warning {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #f0d7a5;
  background: #fff8e8;
}

.lesson-video-cover-preview {
  display: block;
  max-width: 240px;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.video-placeholder {
  display: grid;
  gap: 10px;
  min-height: 120px;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f6faf7;
  color: var(--green);
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: center;
}

.lesson-preview {
  display: grid;
  gap: 12px;
  padding: 12px 0;
}

.checkbox-stack {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.checkbox-stack label,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #303944;
  font-weight: 700;
}

.homework-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.homework-stats span {
  display: block;
  color: var(--muted);
}

.homework-stats b {
  color: var(--ink);
}

.task-panel p {
  display: flex;
  gap: 12px;
  align-items: center;
}

.task-panel p span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #cfe5d3;
  border-radius: var(--radius);
  background: #f3fbf4;
  color: #2c4732;
}

.upload-box {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #cbd5ce;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.upload-box span {
  font-size: 42px;
  color: #9ea7a1;
}

.file-input {
  display: none;
}

.upload-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.uploaded-file {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
}

.uploaded-file span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eaf5ec;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.uploaded-file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.video-upload p {
  color: var(--muted);
  line-height: 1.45;
}

.video-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.video-list article {
  display: grid;
  gap: 8px;
}

.video-list video {
  width: 100%;
  max-height: 190px;
  border-radius: 7px;
  background: #111;
}

.video-list span {
  color: var(--muted);
  font-size: 13px;
}

.call-hero {
  grid-template-columns: 1.2fr .9fr auto;
}

.mentor-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mentor-line small {
  color: rgba(255,255,255,.76);
}

.call-row {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr) 140px 112px 130px minmax(250px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}

.call-row:last-child { border-bottom: 0; }
.row-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft-green);
  color: var(--green);
}

.call-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.call-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.call-row-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.danger-outline {
  color: #b35a00;
  border-color: #f0c98d;
  background: #fff9ef;
}

.danger-outline:hover {
  background: #fff2d9;
}

.danger-ghost {
  color: #b3261e;
  border-color: #f1c5c0;
  background: #fff7f6;
}

.danger-ghost:hover {
  background: #ffe8e5;
}

.call-note {
  margin: 0;
  color: #f7d6d6;
  font-weight: 800;
}

.call-reminder-cancelled {
  opacity: .92;
}

.call-reminder-cancelled small {
  color: #8a5a5a;
}

.call-reminder-cancelled .badge {
  margin-top: 6px;
}

.call-modal {
  width: min(860px, 100%);
  padding: 22px;
  box-shadow: 0 28px 90px rgba(7, 20, 15, .28);
}

.call-modal.small {
  width: min(640px, 100%);
}

.call-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.call-form-grid textarea {
  min-height: 110px;
}

.call-modal-actions {
  align-items: center;
}

.teacher-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.teacher-group-card {
  display: grid;
  gap: 14px;
}

.teacher-group-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.teacher-group-metrics span {
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
}

.teacher-group-metrics b {
  display: block;
  color: var(--ink);
  font-size: 18px;
  margin-bottom: 3px;
}

.users-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.users-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.users-sidebar {
  width: 100%;
  min-width: 0;
  position: static;
  z-index: auto;
}

.user-role-tabs {
  margin-bottom: 0;
}

.user-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) minmax(260px, 1.4fr);
  gap: 10px;
  align-items: center;
}

.user-filter-grid select,
.user-filter-grid input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 9px 12px;
}

.admin-users-panel {
  overflow-x: auto;
  overflow-y: visible;
}

.admin-user-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}

.admin-user-row.header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.admin-user-row.selected {
  margin-left: -10px;
  margin-right: -10px;
  padding-left: 10px;
  padding-right: 10px;
  border-radius: 8px;
  background: #f6fbf7;
}

.admin-user-row.all {
  grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1.1fr) 110px minmax(130px, 1fr) 110px 130px minmax(200px, auto);
}

.admin-user-row.student {
  grid-template-columns: minmax(145px, 1fr) minmax(145px, 1fr) minmax(110px, .8fr) minmax(120px, .8fr) minmax(130px, .9fr) 105px minmax(130px, .9fr) 120px minmax(260px, auto);
}

.admin-user-row.teacher {
  grid-template-columns: minmax(145px, 1fr) minmax(145px, 1fr) minmax(150px, 1fr) minmax(120px, .8fr) 70px 70px 80px 100px minmax(220px, auto);
}

.admin-user-row.admin {
  grid-template-columns: minmax(160px, 1.1fr) minmax(170px, 1fr) 130px minmax(180px, 1fr) 130px 100px minmax(180px, auto);
}

.admin-user-row:last-child {
  border-bottom: 0;
}

.admin-user-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.user-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.user-detail-card {
  padding: 20px;
}

.user-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.user-detail-grid span {
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
}

.user-detail-grid b {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.student-security-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.student-security-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.student-security-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.student-security-actions .btn {
  width: 100%;
  justify-content: center;
}

.access-reveal-box {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px dashed rgba(36, 115, 56, .35);
  background: rgba(36, 115, 56, .06);
}

.access-reveal-box p {
  margin: 0 0 8px;
}

.access-reveal-box code {
  font-size: 15px;
  color: var(--ink);
}

.password-change-backdrop {
  z-index: 120;
}

.student-drawer-actions,
.admin-user-drawer .student-security-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.user-modal {
  width: min(820px, 100%);
  padding: 22px;
}

.user-modal.small {
  width: min(620px, 100%);
}

.course-modal {
  width: min(980px, 100%);
}

.course-modal-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.course-modal-list h3 {
  margin: 12px 0 2px;
}

.course-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.course-stat-grid span {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
}

.course-stat-grid b {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.user-form-grid textarea {
  min-height: 110px;
}

.user-row, .course-admin-row, .review-row {
  display: grid;
  grid-template-columns: 42px minmax(170px, 1.2fr) 120px minmax(130px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(110px, .8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ed;
}

.course-admin-row {
  grid-template-columns: minmax(260px, 1.3fr) 120px 110px minmax(180px, auto);
}

.review-row {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 120px auto;
}

.user-row:last-child, .course-admin-row:last-child, .review-row:last-child {
  border-bottom: 0;
}

.user-row small, .course-admin-row small, .review-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.admin-actions-grid, .quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-actions {
  grid-template-columns: 1fr;
}

.community-layout {
  display: grid;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  overflow: visible;
}

.community-layout.no-chat {
  grid-template-columns: 56px 56px minmax(0, 1fr);
}

.community-layout.has-chat {
  grid-template-columns: 56px 56px minmax(0, 1fr);
}

.community-layout.no-chat .community-topics-expanded {
  min-height: min(72vh, 780px);
  max-height: calc(100vh - 180px);
  align-self: stretch;
}

.community-layout.no-chat .community-topics-expanded .community-discussions-head,
.community-layout.no-chat .community-topics-expanded .community-discussions-hint {
  flex-shrink: 0;
}

.community-layout.no-chat .community-topics-expanded .community-discussions-topic-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.community-discussions-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--soft-green);
}

.community-discussions-hint strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}

.community-discussions-hint p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.community-general-chat-sidecard {
  margin: 4px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--soft-green);
}

.community-general-chat-sidecard.is-active {
  border-color: rgba(45, 106, 79, 0.35);
  box-shadow: inset 3px 0 0 var(--accent);
}

.community-general-chat-sidecard strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
}

.community-general-chat-sidecard p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.community-group-chat-list {
  display: grid;
  gap: 8px;
}

button.community-group-chat-row {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.community-group-chat-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.responsibility-multi-group-hint {
  font-size: 13px;
  line-height: 1.45;
}

.community-general-chat-panel .teacher-private-chat-head h2 {
  font-size: 18px;
}

.category-panel, .discussion-panel, .featured-topic {
  padding: 16px;
}

.category-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.category-row.active, .category-row:hover {
  background: var(--soft-green);
  color: var(--green);
}

.category-row b {
  color: var(--muted);
}

.pin-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 10px 0;
  color: #38433d;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 90px auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #edf0ed;
}

.topic-row.active {
  margin: 0 -10px;
  padding: 15px 10px;
  border-radius: 8px;
  background: #f5faf6;
}

.topic-row h3 {
  margin: 0 0 8px;
}

.topic-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.topic-row p span {
  color: var(--blue);
  font-weight: 700;
}

.topic-row-status {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.featured-topic {
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: start center;
  padding: 48px 18px;
  overflow: auto;
  background: rgba(9, 22, 18, .42);
}

.topic-modal {
  width: min(780px, 100%);
  max-width: 820px;
  padding: 20px 22px;
  box-shadow: 0 28px 90px rgba(7, 20, 15, .28);
}

.topic-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.topic-form-grid textarea {
  min-height: 120px;
}

.topic-modal .field.field-invalid label {
  color: #b54708;
}

.topic-modal .field.field-invalid input,
.topic-modal .field.field-invalid select,
.topic-modal .field.field-invalid textarea {
  border-color: #e08a4a;
  box-shadow: 0 0 0 1px rgba(224, 138, 74, 0.18);
}

.topic-form-error-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: #b54708;
}

.similar-topics-hint {
  padding: 10px 12px;
  border: 1px solid #e8eaee;
  border-radius: 8px;
  background: #f6f7f9;
}

.similar-topics-hint-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 8px;
}

.similar-topics-hint-head strong {
  font-size: 13px;
}

.similar-topics-hint-head .muted {
  font-size: 12px;
}

.similar-topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 0;
}

.similar-topic-row + .similar-topic-row {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.similar-topic-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.similar-topic-badge {
  flex-shrink: 0;
  font-size: 10px;
  padding: 2px 6px;
  line-height: 1.3;
}

.similar-topic-open {
  flex-shrink: 0;
  min-height: 0;
  padding: 4px 10px;
  font-size: 12px;
}

.topic-attach-field {
  margin-top: 2px;
}

.topic-attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-attach-btn {
  min-height: 0;
  padding: 7px 12px;
  font-size: 13px;
}

.similar-topics {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #dbe8de;
  border-radius: 8px;
  background: #f7fbf8;
}

.similar-topics h3 {
  margin: 0 0 6px;
}

.similar-topics > p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.similar-topic-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e0e9e3;
}

.similar-topic-card:last-child {
  border-bottom: 0;
}

.similar-topic-card strong {
  display: block;
  margin-bottom: 4px;
}

.similar-topic-card span {
  color: var(--muted);
  font-size: 13px;
}

body[data-theme="dark"] .similar-topics-hint {
  background: #171f1c;
  border-color: #2a3a30;
}

body[data-theme="dark"] .similar-topic-row + .similar-topic-row {
  border-top-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .similar-topics-hint .similar-topic-badge {
  background: rgba(88, 185, 108, .24);
  color: #d7ffdf;
}

.topic-warning {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #f2cc8c;
  border-radius: 8px;
  background: #fff8ed;
}

.topic-warning p {
  margin: 6px 0 12px;
  color: #6b5837;
}

.topic-modal-actions {
  margin-top: 16px;
}

.topic-detail > p {
  color: #303a34;
  line-height: 1.55;
}

.topic-link-line {
  margin: 8px 0;
  color: var(--muted);
}

.topic-answers {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.topic-answer {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topic-answer.teacher-answer {
  border-color: #a9d5b0;
  background: #effaf0;
}

.topic-answer p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.official-answer {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #a9d5b0;
  border-radius: 8px;
  background: #effaf0;
}

.plots-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.plot-list {
  display: grid;
  align-content: start;
  gap: 12px;
}

.plot-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  text-align: left;
}

.plot-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(36,115,56,.12);
}

.plot-card img {
  width: 108px;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
}

.plot-card strong {
  display: block;
  margin-bottom: 6px;
}

.plot-card em {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-style: normal;
}

.pager {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.pager button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.plot-detail {
  padding: 22px;
}

.plot-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.plot-head h2 {
  margin: 0;
  font-size: 25px;
}

.plot-form {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 26px;
}

.plot-fields {
  display: grid;
  gap: 0;
}

.field-line {
  padding: 10px 0;
  border-bottom: 1px solid #edf0ed;
}

.field-line b {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.field-line span, .field-line p {
  margin: 0;
  color: #242b31;
  line-height: 1.45;
}

.field-line.teacher p {
  padding: 12px;
  border-radius: 7px;
  background: #eaf3fd;
}

.screens {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.screens img, .screens button {
  height: 78px;
  border-radius: 7px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.screens button {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.screens button span {
  display: block;
  font-size: 13px;
}

.doc-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-chips span, .doc-chips button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 10px 14px;
}

.doc-chips em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.plot-bottom {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.plot-bottom > div {
  padding: 15px;
  border-right: 1px solid var(--line);
}

.plot-bottom > div:last-child { border-right: 0; }
.plot-bottom ul { margin: 10px 0 0; padding: 0; list-style: none; line-height: 1.7; }
.plot-bottom li { color: #28332c; }
.reviewer { line-height: 1.35; }

.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.doc-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.doc-search {
  min-width: 0;
}

.doc-status-tabs {
  justify-content: flex-end;
  margin-bottom: 0;
}

.doc-card {
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.doc-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-card-head > div:last-child {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.doc-card h3 {
  margin: 0;
}

.doc-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-tags > span:not(.badge) {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  background: #f1f5f2;
  color: #4f5b54;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.doc-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.empty-state {
  padding: 28px;
  text-align: center;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.profile-form .btn {
  grid-column: 1 / -1;
}

.nickname-field {
  grid-column: 1 / -1;
}

.nickname-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.nickname-prefix {
  padding: 10px 0 10px 12px;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}

.nickname-input-wrap input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding-left: 4px;
  flex: 1;
  min-width: 0;
}

.nickname-field small,
.profile-about-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.profile-security-layout {
  display: grid;
  gap: 14px;
  max-width: 560px;
}

.toggle-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.toggle-row span {
  display: grid;
  gap: 4px;
}

.toggle-row small {
  color: var(--muted);
}

.toggle-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.toggle-row.compact {
  margin: 14px 0;
}

.vk-panel {
  padding: 22px;
}

.vk-panel .section-title {
  align-items: flex-start;
}

.vk-panel h2 {
  margin-bottom: 6px;
}

.vk-panel p {
  line-height: 1.5;
}

.vk-connected, .vk-connect-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.vk-connected div, .vk-connect-flow div {
  display: grid;
  gap: 5px;
}

.vk-connected span, .vk-connect-flow span {
  color: var(--muted);
  line-height: 1.45;
}

.vk-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.vk-settings label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #2b333a;
  font-weight: 750;
}

.vk-settings input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.progress-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.progress-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.progress-sidebar {
  width: 100%;
  min-width: 0;
  position: static;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: auto;
}

.progress-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.progress-card {
  min-height: 260px;
  padding: 24px;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.progress-card h2 {
  margin: 0;
  font-size: 20px;
}

.progress-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.progress-card.overall {
  text-align: center;
}

.progress-card.overall .ring {
  margin-top: 2px;
  margin-bottom: 4px;
}

.progress-card.overall > strong {
  font-size: 17px;
}

.progress-number {
  display: grid;
  gap: 5px;
}

.progress-number strong {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.progress-number span {
  color: var(--muted);
  font-weight: 750;
}

.progress-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.progress-card-foot b {
  color: var(--green);
  font-size: 22px;
}

.plot-status-list {
  display: grid;
  gap: 9px;
}

.plot-status-list span {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  border-radius: 8px;
  background: #f3f8f4;
  color: #304139;
  font-weight: 800;
}

.progress-modules {
  padding: 24px;
  border-radius: 16px;
}

.progress-module-list {
  display: grid;
  gap: 10px;
}

.progress-module-row {
  display: grid;
  grid-template-columns: 112px minmax(260px, 1fr) 160px 96px 150px 116px 140px;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.progress-module-row.locked {
  background: #fafafa;
}

.module-index {
  display: inline-flex;
  justify-content: center;
  padding: 7px 9px;
  border-radius: 8px;
  background: #eef7ef;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.module-title {
  display: grid;
  gap: 4px;
}

.module-title strong {
  font-size: 16px;
}

.module-title span, .progress-module-row small {
  color: var(--muted);
  line-height: 1.35;
}

.module-progress-cell {
  display: grid;
  gap: 7px;
}

.module-progress-cell b {
  color: var(--green);
}

.progress-module-row > div {
  min-width: 0;
}

.progress-module-row > div:not(.module-title):not(.module-progress-cell):not(.module-index) {
  display: grid;
  gap: 5px;
}

.progress-module-row .btn {
  width: 100%;
  min-width: 130px;
  white-space: nowrap;
}

.progress-two-col,
.progress-two-column {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: start;
}

.status-panel, .achievements-panel, .activity-panel, .next-actions-panel {
  padding: 24px;
  border-radius: 16px;
}

.progress-two-col > .status-panel,
.progress-two-col > .achievements-panel,
.progress-two-column > .status-panel,
.progress-two-column > .achievements-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 1px rgba(18, 27, 22, .02);
}

.status-summary {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 16px;
  align-items: center;
}

.status-summary .status-medal {
  width: 72px;
  height: 72px;
  margin: 0;
  font-size: 34px;
}

.status-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
}

.status-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.next-status {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.next-status h3 {
  margin: 0 0 2px;
  font-size: 17px;
}

.next-status span {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f3f8f4;
  color: #304139;
  font-weight: 800;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.achievement {
  min-height: 104px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.achievement span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef7ef;
  color: var(--green);
  font-size: 20px;
}

.achievement.locked {
  color: #858c92;
  background: #fafafa;
}

.achievement.locked span {
  background: #eef0ef;
  color: #8b9298;
}

.activity-content {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 320px;
  gap: 20px;
  align-items: end;
}

.activity-bars {
  height: 180px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 16px;
  border-radius: 12px;
  background: #f7faf8;
}

.activity-bars div {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 9px;
  align-items: end;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.activity-bars i {
  width: 100%;
  min-height: 18px;
  align-self: end;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #43ad54, #247338);
}

.activity-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.activity-stats span {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
}

.activity-stats b {
  color: var(--ink);
  font-size: 26px;
}

.next-actions-panel {
  display: grid;
  gap: 10px;
}

.next-action-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 130px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.next-action-row > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef7ef;
  color: var(--green);
  font-weight: 900;
}

.progress-rail-list {
  display: grid;
  gap: 10px;
}

.progress-rail-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0ed;
  color: var(--muted);
}

.progress-rail-list span:last-child {
  border-bottom: 0;
}

.progress-rail-list b {
  color: var(--green);
}

.security-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #d8e4dc;
  border-radius: 8px;
  background: #f4f8f4;
  color: #415047;
  font-size: 13px;
}

.teacher-profile-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 22px;
}

.teacher-avatar-large {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.teacher-avatar-large .avatar {
  width: 92px;
  height: 92px;
}

.teacher-profile-card h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.teacher-profile-card p {
  color: #46504b;
  line-height: 1.5;
}

.teacher-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.teacher-tags span {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 7px;
  background: #eef7ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.teacher-tags.vertical {
  display: grid;
}

.teacher-form textarea {
  min-height: 96px;
}

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

.mentor-card {
  padding: 20px;
}

.mentor-profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.mentor-profile-row strong {
  display: block;
  margin-bottom: 3px;
}

.mentor-profile-row small, .mentor-card p {
  color: var(--muted);
  line-height: 1.45;
}

.mentor-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.mentor-facts span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
}

.mentor-facts b {
  color: #202830;
}

.groups-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.groups-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.groups-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.groups-sidebar {
  width: 100%;
  min-width: 0;
  position: static;
  z-index: auto;
}

.groups-top-panel {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.groups-top-panel h2 {
  margin: 0 0 6px;
}

.groups-top-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.group-top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.group-tabs span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef4ef;
  color: var(--muted);
  font-size: 12px;
}

.group-tabs .active span {
  background: #dff1e2;
  color: var(--green);
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.admin-groups-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  margin-bottom: 0;
}

.group-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.group-card.active {
  border-color: rgba(36,115,56,.55);
  box-shadow: 0 0 0 2px rgba(36,115,56,.1);
}

.admin-group-card.archived {
  background: #fbfbfa;
}

.group-card p {
  margin: 0;
  color: #4b5550;
  line-height: 1.45;
}

.group-meta, .group-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.group-meta span, .group-summary span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
}

.group-meta b, .group-summary b {
  color: #202830;
  font-size: 18px;
}

.admin-group-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-group-meta span {
  min-height: 64px;
}

.admin-group-meta b {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.group-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.group-actions .btn {
  min-height: 36px;
  padding: 8px 12px;
}

.group-create, .group-detail {
  padding: 22px;
  margin-bottom: 16px;
}

.group-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.student-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.student-checks label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 750;
}

.student-checks input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.group-teacher-strip, .plot-mentor-note {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #dbe8de;
  border-radius: 8px;
  background: #f6fbf7;
}

.group-teacher-strip strong, .plot-mentor-note strong {
  display: block;
}

.group-teacher-strip small, .plot-mentor-note small {
  color: var(--muted);
}

.group-detail-actions {
  margin: 10px 0 18px;
}

.group-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.group-detail-grid section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.group-detail-grid section.group-card {
  --accent: #247338;
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(36, 115, 56, .1);
  box-shadow: 0 14px 28px rgba(19, 42, 26, .06);
}

.group-detail-grid section.group-card::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 92%, white) 0%,
    color-mix(in srgb, var(--accent) 62%, white) 100%
  );
  box-shadow: 0 1px 0 rgba(255, 255, 255, .32) inset;
  pointer-events: none;
}

.group-detail-grid h3 {
  margin: 0 0 10px;
}

.group-detail-grid section.group-card > h3 {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(36, 115, 56, .08);
}

.group-detail-grid .group-card .compact-row,
.group-detail-grid .group-card .compact-row.action-row {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(36, 115, 56, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
}

.group-detail-grid .group-card .compact-row:last-child,
.group-detail-grid .group-card .compact-row.action-row:last-child {
  margin-bottom: 0;
}

.group-detail-grid .group-card .compact-row,
.group-detail-grid .group-card .compact-row.action-row {
  border-bottom: 1px solid rgba(36, 115, 56, .08);
}

.group-detail-grid .group-card .compact-row.action-row:hover {
  margin-left: 0;
  margin-right: 0;
  padding-left: 14px;
  padding-right: 14px;
  transform: translateY(-1px);
  border-radius: 12px;
  background: rgba(243, 248, 244, .96);
  border-color: rgba(36, 115, 56, .18);
}

.group-detail-grid .group-card .empty-inline {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .62);
  border: 1px dashed rgba(36, 115, 56, .16);
}

.group-subtitle {
  margin-top: 16px !important;
}

.students-card {
  --accent: #247338;
  background: linear-gradient(180deg, #fcfdfd 0%, #ffffff 100%);
  border-color: #dfe7e2;
}

.homework-card {
  --accent: #d28a12;
  background: linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
  border-color: #f0e1b8;
}

.tickets-card {
  --accent: #4790c4;
  background: linear-gradient(180deg, #f5fbff 0%, #ffffff 100%);
  border-color: #d9eaf6;
}

.community-card {
  --accent: #3e9764;
  background: linear-gradient(180deg, #f6fbf7 0%, #ffffff 100%);
  border-color: #d9e8db;
}

.calls-card {
  --accent: #3d9a84;
  background: linear-gradient(180deg, #f5fbfa 0%, #ffffff 100%);
  border-color: #d6e8df;
}

.history-card {
  --accent: #9a7c4f;
  background: linear-gradient(180deg, #fbfaf7 0%, #ffffff 100%);
  border-color: #e7dfd1;
}

.group-mini-block {
  display: grid;
  gap: 10px;
}

.mini-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.mini-block-head p {
  margin: 0;
  color: var(--muted);
}

.topic-badge-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-badge-stack span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.group-modal {
  width: min(980px, 100%);
}

.compact-notice {
  padding: 10px 12px;
}

.group-student-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0 16px;
}

.group-student-picker label {
  align-items: flex-start;
}

.group-student-picker small {
  display: block;
  color: var(--muted);
  font-weight: 650;
}

.support-ticket-form, .support-history, .ticket-detail {
  padding: 22px;
}

.support-form-grid {
  display: grid;
  grid-template-columns: minmax(230px, .78fr) minmax(0, 1.22fr);
  gap: 18px;
}

.message-field {
  grid-row: span 3;
}

.message-field textarea {
  min-height: 178px;
}

.support-attach {
  align-self: end;
}

.support-toolbar {
  display: grid;
  gap: 12px;
}

.support-tabs, .support-extra-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.support-tabs button, .support-extra-filters select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #343b43;
  padding: 8px 14px;
  font-weight: 750;
}

.support-tabs button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.ticket-list {
  display: grid;
  gap: 12px;
}

.ticket-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.ticket-card:hover {
  transform: translateY(-2px);
  border-color: rgba(36, 115, 56, 0.38);
  background: #fcfefc;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.ticket-card:hover .btn.secondary {
  border-color: rgba(36, 115, 56, 0.42);
  background: #eef7ef;
  color: var(--accent);
}

.ticket-card:focus-within {
  outline: none;
  border-color: rgba(36, 115, 56, 0.52);
  box-shadow: 0 0 0 3px rgba(36, 115, 56, 0.14);
}

.ticket-card .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ticket-card.active {
  border-color: rgba(36,115,56,.55);
  box-shadow: 0 0 0 2px rgba(36,115,56,.11);
}

.ticket-card.active:hover {
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08), 0 0 0 2px rgba(36, 115, 56, 0.14);
}

.ticket-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ticket-card h3 {
  margin: 0;
}

.ticket-card p {
  margin: 0 0 12px;
  color: #3a424a;
  line-height: 1.45;
}

.ticket-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.ticket-meta {
  display: grid;
  align-content: start;
  gap: 10px;
  justify-items: end;
}

.ticket-card .btn, .ticket-card button, .ticket-card select {
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.ticket-status {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.ticket-status.blue { background: #e8f1fc; color: #2169bd; }
.ticket-status.amber { background: #fff2d9; color: #dd8300; }
.ticket-status.green { background: #e9f6eb; color: #217036; }
.ticket-status.neutral { background: #eff1f0; color: #6a7178; }
.ticket-status.red { background: #fde9e9; color: #d43838; }

.ticket-badge-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ticket-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.ticket-summary span {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: #28332c;
  line-height: 1.35;
}

.ticket-summary b, .ticket-summary small {
  display: block;
}

.ticket-summary b {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-summary small {
  margin-top: 4px;
  color: var(--muted);
}

.ticket-actions-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.ticket-actions-bar .field {
  margin: 0;
}

.empty-inline {
  padding: 18px;
  border: 1px dashed #cfd8d2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.lessons-empty-state {
  padding: 32px 28px;
  text-align: center;
}

.lessons-empty-state h2 {
  margin: 0 0 12px;
}

.lessons-empty-state p {
  margin: 0 auto 20px;
  max-width: 34rem;
  line-height: 1.5;
}

.lessons-empty-state .btn {
  margin-top: 4px;
}

.lessons-module-empty {
  margin: 0;
  padding: 12px 4px 4px;
}

.message-thread {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.message-bubble {
  width: min(760px, 88%);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.message-bubble.support {
  justify-self: end;
  background: #eef8f0;
  border-color: #cfe5d3;
}

.message-bubble strong {
  display: block;
  margin-bottom: 8px;
}

.message-bubble strong span {
  color: var(--muted);
  font-size: 12px;
}

.message-bubble p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.message-bubble em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ticket-attachments {
  margin-bottom: 16px;
}

.support-stats {
  display: grid;
  gap: 9px;
}

.support-stats span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0ed;
  color: var(--muted);
}

.support-stats b {
  order: 2;
  color: var(--ink);
}

.support-guide-panel {
  padding: 16px 16px 14px;
}

.support-guide-panel h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.support-guide-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.support-guide-sections {
  display: grid;
  gap: 8px;
}

.support-guide-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbf8;
  overflow: hidden;
}

.support-guide-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.support-guide-summary::-webkit-details-marker {
  display: none;
}

.support-guide-summary::after {
  content: "+";
  margin-left: auto;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.support-guide-section[open] .support-guide-summary::after {
  content: "−";
}

.support-guide-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(36, 115, 56, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.support-guide-list {
  margin: 0;
  padding: 0 12px 12px 38px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.support-guide-list li {
  position: relative;
}

.support-guide-list li::marker {
  color: var(--accent);
}

.support-guide-timing {
  padding: 0 12px 12px 38px;
  font-size: 13px;
  line-height: 1.5;
}

.support-guide-timing p {
  margin: 0 0 8px;
}

.support-guide-timing p:last-child {
  margin-bottom: 0;
}

.support-guide-panel .link-inline {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.teacher-dialog-student-layout {
  display: grid;
  gap: 12px;
}

.teacher-dialog-mentor-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
}

.teacher-dialog-mentor-card strong {
  display: block;
  margin-bottom: 2px;
}

.teacher-dialog-mentor-card p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

body[data-theme="dark"] .support-guide-section {
  background: #162018;
  border-color: #2a3a30;
}

body[data-theme="dark"] .support-guide-lead,
body[data-theme="dark"] .support-guide-timing .muted {
  color: #b8c5bb;
}

body[data-theme="dark"] .support-guide-list {
  color: #eaf3ec;
}

.quick-links {
  display: grid;
  gap: 10px;
}

.notification-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.notification-metrics button {
  display: grid;
  gap: 6px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  color: inherit;
  text-align: left;
}

.notification-metrics button.active {
  border-color: rgba(36,115,56,.52);
  background: linear-gradient(135deg, #f1fbf2, #fff);
  box-shadow: 0 0 0 2px rgba(36,115,56,.1);
}

.notification-metrics span {
  color: var(--muted);
  font-weight: 750;
}

.notification-metrics strong {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.notification-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.notification-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #343b43;
  padding: 8px 14px;
  font-weight: 750;
}

.notification-tabs button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.notification-group {
  display: grid;
  gap: 12px;
}

.notification-group h2 {
  margin: 0;
  font-size: 20px;
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 210px;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.notification-card:hover {
  transform: translateY(-1px);
  border-color: rgba(36,115,56,.45);
  box-shadow: 0 14px 32px rgba(20, 36, 28, .08);
}

.notification-card.unread {
  background: linear-gradient(90deg, #f1fbf2, #fff 58%);
  border-color: #cde5d1;
}

.notification-card.important {
  box-shadow: inset 4px 0 0 rgba(243, 163, 34, .95);
}

.notice-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #edf5ef;
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}

.notice-icon.homework { background: #edf5ff; color: var(--blue); }
.notice-icon.plots { background: #eef8f0; color: var(--green); }
.notice-icon.calls { background: #fff4df; color: #ce7600; }
.notice-icon.community { background: #f1efff; color: var(--violet); }
.notice-icon.docs { background: #f4f6f7; color: #59616a; }
.notice-icon.support { background: #fff2d9; color: #c66c00; }

.notification-main {
  min-width: 0;
}

.notification-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.notification-title-row h3 {
  margin: 0;
  font-size: 18px;
}

.notification-card.read h3 {
  color: #4d555d;
}

.notification-main p {
  margin: 8px 0 12px;
  color: #3a424a;
  line-height: 1.5;
}

.notification-card.read p {
  color: var(--muted);
}

.notification-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.notification-meta span + span::before {
  content: "•";
  margin-right: 10px;
  color: #a5ada8;
}

.notice-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notice-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.notice-chip.new { background: #e8f5ea; color: var(--green); }
.notice-chip.read { background: #eff1f0; color: #6a7178; }
.notice-chip.important { background: #fff2d9; color: #d57b00; }
.notice-chip.action { background: #fde9e9; color: #d43838; }

.notification-controls {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.notification-controls .btn {
  width: 100%;
}

.icon-btn.subtle {
  width: 34px;
  height: 34px;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 20px;
}

.notice-task {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  background: transparent;
  padding: 12px 0;
  color: inherit;
  text-align: left;
}

.notice-task span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--soft-green);
  color: var(--green);
}

.notice-task strong, .notice-task small {
  grid-column: 2;
}

.notice-task strong {
  margin-bottom: -4px;
}

.notice-task small {
  color: var(--muted);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0ed;
  color: var(--muted);
}

.setting-row b {
  color: var(--green);
}

.notification-empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 42px;
  text-align: center;
}

.notification-empty.compact {
  min-height: 260px;
}

.notification-empty > span {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 20px;
  background: var(--soft-green);
  color: var(--green);
  font-size: 34px;
}

.notification-empty p {
  max-width: 560px;
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.toast-host {
  position: fixed;
  top: 90px;
  right: 24px;
  z-index: 100;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 48px));
}

.toast {
  position: relative;
  right: auto;
  bottom: auto;
  top: auto;
  z-index: 100;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #123d2d;
  color: #fff;
  box-shadow: 0 12px 32px rgba(20, 36, 28, .22);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: auto;
  animation: toastIn .18s ease-out;
}

.stats-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats-mini span {
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}

.stats-mini b {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 6px;
  background: #f2f4f3;
  color: #5f6870;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.badge.green { background: var(--accent-soft); color: var(--accent-hover); }
.badge.blue { background: #e8f1fc; color: #2169bd; }
.badge.amber { background: #fff2d9; color: #dd8300; }
.badge.red { background: #fde9e9; color: #d43838; }
.badge.violet { background: #efedff; color: #5a4ee3; }

.breadcrumbs {
  margin-bottom: 26px;
  color: var(--muted);
}

.watermark {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 30;
  pointer-events: none;
  color: rgba(16, 39, 31, .22);
  font-size: 12px;
  text-align: right;
}

.small, small { font-size: 13px; }
.slim { min-width: 360px; }

@media (max-width: 1280px) {
  .dashboard-grid, .notification-layout, .groups-layout, .groups-page-layout, .users-page-layout { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-admin-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-lesson-row { grid-template-columns: 96px minmax(240px, 1fr) 116px 98px 138px; }
  .course-hero, .plot-form { grid-template-columns: 1fr; }
  .course-meta { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; grid-template-columns: repeat(2, 1fr); }
  .progress-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-module-row { grid-template-columns: 90px minmax(220px, 1fr) 150px 88px; }
  .progress-module-row .btn { grid-column: span 1; }
  .activity-content { grid-template-columns: 1fr; }
  .user-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-sidebar, .groups-sidebar { order: 2; }
}

@media (max-width: 1500px) {
  .progress-page-layout {
    grid-template-columns: 1fr;
  }

  .progress-sidebar {
    order: 2;
  }
}

@media (max-width: 1100px) {
  .shell, .shell.compact-sidebar { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 278px;
    transform: translateX(-104%);
    transition: transform .2s ease;
    z-index: 60;
  }
  .shell.compact-sidebar .brand-text,
  .shell.compact-sidebar .role-switch,
  .shell.compact-sidebar .help-card {
    display: initial;
  }
  .shell.compact-sidebar .help-card {
    display: grid;
  }
  .shell.compact-sidebar .menu button {
    grid-template-columns: 28px 1fr auto;
    justify-items: stretch;
    padding: 10px 12px;
  }
  .shell.compact-sidebar .menu button span:not(.icon),
  .shell.compact-sidebar .menu-dot {
    display: initial;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { grid-template-columns: auto 1fr auto auto; padding: 0 16px; }
  .content { padding: 20px 16px; }
  .plots-layout, .two-panels, .kpi-grid, .lesson-cards, .docs-grid, .notification-metrics, .groups-grid, .admin-groups-grid, .group-detail-grid, .progress-two-col, .progress-two-column, .teacher-group-grid, .user-detail-grid, .groups-top-panel { grid-template-columns: 1fr; }
  .ticket-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-actions-bar { grid-template-columns: 1fr; }
  .plot-bottom { grid-template-columns: 1fr 1fr; }
  .notification-card { grid-template-columns: 46px minmax(0, 1fr); }
  .notification-controls { grid-column: 2; }
  .notification-popover { right: 16px; }
}

@media (max-width: 760px) {
  .landing header { align-items: flex-start; gap: 16px; }
  .nav-links { justify-content: flex-end; }
  .public-section { grid-template-columns: 1fr; }
  .hero { min-height: 64vh; }
  .page-head, .plot-head { display: grid; }
  .right-rail, .homework-stats, .course-meta, .module-summary, .lesson-module-head, .lesson-line, .call-row, .topic-row, .topic-form-grid, .call-form-grid, .similar-topic-card, .profile-form, .support-form-grid, .ticket-card, .notification-card, .teacher-profile-card, .group-form, .group-meta, .group-summary, .student-checks, .group-student-picker, .group-teacher-strip, .plot-mentor-note, .progress-kpi-grid, .progress-module-row, .status-summary, .activity-stats, .next-action-row, .teacher-group-metrics, .user-row, .course-admin-row, .review-row, .admin-actions-grid, .user-filter-grid, .admin-user-row.all, .admin-user-row.student, .admin-user-row.teacher, .admin-user-row.admin, .user-form-grid, .course-stat-grid, .lesson-admin-filters, .admin-lesson-row { grid-template-columns: 1fr; }
  .mini-block-head {
    display: grid;
  }
  .topic-badge-stack {
    justify-content: flex-start;
  }
  .admin-lesson-row .lesson-bits {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
  .admin-lesson-date {
    justify-self: start;
  }
  .admin-lesson-row .row-actions {
    grid-column: auto;
    justify-content: stretch;
  }
  .admin-lesson-row .row-actions .btn {
    width: 100%;
  }
  .group-top-actions { justify-content: stretch; }
  .group-top-actions .btn { width: 100%; }
  .achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-module-row .btn, .next-action-row .btn { width: 100%; min-width: 0; }
  .ticket-summary { grid-template-columns: 1fr; }
  .vk-connected, .vk-connect-flow { display: grid; }
  .vk-settings { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .doc-toolbar { grid-template-columns: 1fr; }
  .doc-status-tabs { justify-content: flex-start; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .profile-chip strong { display: none; }
  .top-search input { min-width: 0; }
  .global-search-popover { left: -48px; right: -78px; }
  .search-result-row { grid-template-columns: 1fr; }
  .search-result-row span { grid-row: auto; }
  .event-hero, .call-hero { grid-template-columns: 1fr; }
  .screens { grid-template-columns: repeat(2, 1fr); }
  .plot-bottom { grid-template-columns: 1fr; }
  .plot-bottom > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .plot-bottom > div:last-child { border-bottom: 0; }
  .plot-card { grid-template-columns: 92px 1fr; }
  .plot-card img { width: 92px; }
  .notification-title-row { display: grid; }
  .notification-controls { grid-column: auto; }
  .notification-popover { top: 60px; right: 10px; left: 10px; width: auto; }
  .profile-menu { top: 60px; right: 10px; width: 230px; }
  .mini-notice-list button { grid-template-columns: 30px 1fr; }
  .mini-notice-list small { grid-column: 2; }
  .slim { min-width: 0; }
}

/* Patch: рабочий drawer обращений и более плотные отступы страниц */
.page-head {
  margin-top: 0;
  margin-bottom: 18px;
}
.dashboard-page, .content, main {
  scroll-padding-top: 90px;
}
.ticket-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 1800;
  display: flex;
  justify-content: flex-end;
}
.ticket-drawer {
  position: relative;
  height: 100vh;
  width: min(720px, 100vw);
  background: #fff;
  z-index: 1900;
  overflow-y: auto;
  padding: 22px;
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.24);
}
.ticket-drawer .ticket-detail {
  border: 0;
  box-shadow: none;
  padding: 0;
}
.drawer-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  z-index: 2;
}

.support-queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.support-queue-grid button {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  text-align: left;
  padding: 12px;
  cursor: pointer;
}
.support-queue-grid button:hover {
  border-color: rgba(36, 115, 56, .32);
  background: #f1f8f2;
}
.support-queue-grid b,
.support-queue-grid span {
  display: block;
}
.support-queue-grid b {
  font-size: 24px;
  margin-bottom: 4px;
}
.support-queue-grid span {
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 760px) {
  .ticket-drawer { width: 100vw; padding: 16px; }
  .ticket-summary, .ticket-actions-bar { grid-template-columns: 1fr; }
}

/* Batch fixes by ChatGPT: layout, filters, drawers, action buttons */
.content { padding-top: 20px; }
.page-head { margin-bottom: 20px; }
.dashboard-grid,
.teacher-students-layout,
.teacher-homeworks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.main-column,
.teacher-students-main,
.teacher-homeworks-main { min-width: 0; }
.right-rail,
.teacher-students-sidebar,
.teacher-homeworks-sidebar,
.calls-sidebar {
  position: static;
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}
.teacher-students-filters,
.homework-review-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 180px)) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.homework-review-filters { grid-template-columns: repeat(4, minmax(130px, 170px)) minmax(220px, 1fr) auto; }

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap .animated-hint-search__input {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap:not(.is-filled) .animated-hint-search__input {
  color: transparent;
  caret-color: var(--ink);
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap .animated-hint-search__hint {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  color: #7a8680;
  font-weight: 500;
  line-height: 42px;
  padding: 0 13px;
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap .animated-hint-search__hint-inner {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  will-change: transform;
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap.is-filled .animated-hint-search__hint {
  opacity: 0;
  visibility: hidden;
}

body[data-role="admin"][data-active="homework"] .admin-homework-search-wrap.is-hint-animated:not(.is-filled) .animated-hint-search__hint-inner {
  display: inline-block;
  width: auto;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  animation: admin-homework-search-hint-marquee 4.8s ease-in-out 1 forwards;
}

@keyframes admin-homework-search-hint-marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(var(--hint-marquee-end, 0px)); }
}

body[data-theme="dark"][data-role="admin"][data-active="homework"] .admin-homework-search-wrap {
  background: #121c17;
  border-color: var(--line);
}

body[data-theme="dark"][data-role="admin"][data-active="homework"] .admin-homework-search-wrap .animated-hint-search__input {
  color: var(--ink);
}

body[data-theme="dark"][data-role="admin"][data-active="homework"] .admin-homework-search-wrap:not(.is-filled) .animated-hint-search__input {
  color: transparent;
  caret-color: var(--ink);
}

body[data-theme="dark"][data-role="admin"][data-active="homework"] .admin-homework-search-wrap .animated-hint-search__hint {
  color: #8a968f;
}

.teacher-students-filters select,
.homework-review-filters select,
.support-extra-filters select,
.filters select.filter {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 8px 12px;
  color: #26302a;
  font-weight: 700;
}
.compact-actions,
.mentor-actions,
.help-actions,
.ask-card .row-actions,
.mentor-card .row-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}
.compact-actions .btn,
.mentor-actions .btn,
.help-actions .btn,
.ask-card .row-actions .btn,
.mentor-card .row-actions .btn {
  flex: 1 1 0;
  min-height: 42px;
  white-space: nowrap;
}
.teacher-student-row {
  grid-template-columns: 34px minmax(180px, 1.2fr) minmax(130px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(120px, .8fr) minmax(260px, auto);
}
.teacher-student-row .compact-actions { justify-content: flex-end; }
.review-row {
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.5fr) auto minmax(120px, auto);
}
.ticket-drawer-overlay,
.modal-backdrop {
  z-index: 1800;
}
.ticket-drawer {
  width: min(720px, 100vw);
  z-index: 1900;
}
.ticket-drawer .ticket-summary {
  margin: 14px 0;
}
.student-drawer .tabs,
.review-drawer .tabs { margin-top: 12px; }
.support-queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.support-queue-grid button {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.support-queue-grid button:hover,
.rail-row.action-row:hover {
  border-color: var(--green);
  background: rgba(34, 122, 55, 0.06);
}
.rail-row.action-row.active,
.user-row.active,
.ticket-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(34, 122, 55, .18);
}
.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 122, 55, .08);
  color: var(--green);
  font-weight: 800;
  margin-bottom: 12px;
}
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.profile-stats-grid span {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.profile-stats-grid b { display: block; font-size: 22px; color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1200px) {
  .dashboard-grid,
  .teacher-students-layout,
  .teacher-homeworks-layout {
    grid-template-columns: 1fr;
  }
  .teacher-students-filters,
  .homework-review-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .teacher-students-filters,
  .homework-review-filters,
  .teacher-student-row,
  .review-row,
  .profile-stats-grid {
    grid-template-columns: 1fr;
  }
  .compact-actions,
  .mentor-actions,
  .help-actions,
  .ask-card .row-actions,
  .mentor-card .row-actions {
    flex-direction: column;
  }
  .toast-host {
    top: 78px;
    right: 16px;
    left: auto;
    max-width: calc(100vw - 32px);
  }
  .toast {
    max-width: none;
  }
}

/* Step fix 2026-06-12: teacher students right rail overlap */
body[data-role="mentor"] .teacher-students-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}
body[data-role="mentor"] .teacher-students-main,
body[data-role="mentor"] .teacher-students-main .panel,
body[data-role="mentor"] .teacher-students-main .table-panel {
  min-width: 0;
  overflow: hidden;
}
body[data-role="mentor"] .teacher-students-sidebar,
body[data-role="mentor"] .right-rail.teacher-students-sidebar {
  position: static;
  width: 320px;
  min-width: 0;
  max-width: 320px;
  z-index: 1;
  align-self: start;
}
body[data-role="mentor"] .teacher-students-filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
body[data-role="mentor"] .teacher-students-filters .search {
  grid-column: 1 / 3;
  width: 100%;
}
body[data-role="mentor"] .teacher-student-row {
  grid-template-columns: 34px minmax(150px, 1.15fr) minmax(95px, .7fr) minmax(135px, 1fr) minmax(115px, .85fr) minmax(105px, .75fr) minmax(150px, auto);
  gap: 10px;
  min-width: 0;
}
body[data-role="mentor"] .teacher-student-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}
body[data-role="mentor"] .teacher-student-row .compact-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
body[data-role="mentor"] .teacher-student-row .compact-actions .btn {
  flex: 0 1 auto;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}
body[data-role="mentor"] .teacher-students-sidebar .panel {
  width: 100%;
  box-sizing: border-box;
}
body[data-role="mentor"] .teacher-students-sidebar .stats-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
body[data-role="mentor"] .teacher-students-sidebar .rail-row {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 1320px) {
  body[data-role="mentor"] .teacher-students-layout {
    grid-template-columns: 1fr;
  }
  body[data-role="mentor"] .teacher-students-sidebar,
  body[data-role="mentor"] .right-rail.teacher-students-sidebar {
    width: 100%;
    max-width: none;
  }
}
@media (max-width: 900px) {
  body[data-role="mentor"] .teacher-students-filters,
  body[data-role="mentor"] .teacher-students-filters .search,
  body[data-role="mentor"] .teacher-student-row {
    grid-template-columns: 1fr;
    grid-column: auto;
  }
  body[data-role="mentor"] .teacher-student-row .compact-actions {
    justify-content: stretch;
  }
  body[data-role="mentor"] .teacher-student-row .compact-actions .btn {
    flex: 1 1 120px;
  }
}

/* Step fix 2026-06-12: student group page header and responsibility block */
body[data-role="student"][data-active="groups"] .content {
  padding-top: 10px;
}
body[data-role="student"][data-active="groups"] .page-head {
  margin-bottom: 14px;
}
body[data-role="student"][data-active="groups"] .page-head h1 {
  margin-bottom: 4px;
}
.student-group-responsibility {
  display: grid;
  gap: 14px;
}
.student-group-responsibility .muted {
  margin: -4px 0 0;
  line-height: 1.4;
}
.responsibility-list {
  display: grid;
  gap: 10px;
}
.responsibility-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  background: #fbfcfb;
}
.responsibility-item > span {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(34, 122, 55, .08);
  color: var(--green);
  font-weight: 900;
}
.responsibility-item strong {
  display: block;
  margin-bottom: 2px;
  color: #111827;
}
.responsibility-item small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}
.responsibility-actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}
.responsibility-actions .btn {
  flex: 1 1 0;
  min-height: 42px;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .responsibility-actions {
    flex-direction: column;
  }
}

/* Step 3 fix: реально поднять заголовок на странице ученика «Моя группа» */
body[data-role="student"][data-active="groups"] .content {
  padding-top: 0 !important;
}
body[data-role="student"][data-active="groups"] .page-head {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  transform: translateY(-6px);
}
body[data-role="student"][data-active="groups"] .page-head h1 {
  margin: 0 0 2px !important;
  line-height: 1.05;
}
body[data-role="student"][data-active="groups"] .page-head p {
  margin: 0 !important;
  line-height: 1.25;
}
body[data-role="student"][data-active="groups"] .groups-layout {
  margin-top: -2px;
}

/* Step 4 fix: заголовок «Моя группа» именно в верхней шапке, как на стрелке */
.topbar.has-page-title {
  grid-template-columns: auto minmax(260px, 1fr) minmax(320px, 520px) auto auto;
  justify-content: stretch;
}
.topbar-page-title {
  min-width: 0;
  align-self: center;
  padding-left: 4px;
}
.topbar-page-title strong {
  display: block;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 900;
  color: #111827;
  letter-spacing: -0.02em;
}
.topbar-page-title small {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.1;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-role="student"][data-active="groups"] .content > .page-head {
  display: none !important;
}
body[data-role="student"][data-active="groups"] .content {
  padding-top: 18px !important;
}
@media (max-width: 1100px) {
  .topbar.has-page-title {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }
  .topbar.has-page-title .top-search {
    display: none;
  }
}
@media (max-width: 760px) {
  .topbar-page-title strong { font-size: 20px; }
  .topbar-page-title small { display: none; }
}


/* Step 5 fix: student group card overflow + highlight ближайший созвон */
body[data-role="student"][data-active="groups"] .group-card {
  max-width: 560px;
}
body[data-role="student"][data-active="groups"] .group-meta {
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  gap: 10px;
}
body[data-role="student"][data-active="groups"] .group-meta span {
  min-width: 0;
  min-height: 58px;
  align-content: start;
  overflow: hidden;
}
body[data-role="student"][data-active="groups"] .group-meta b {
  font-size: 15px;
  line-height: 1.12;
  letter-spacing: -0.03em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
body[data-role="student"][data-active="groups"] .group-meta span {
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
body[data-role="student"][data-active="groups"] .group-meta .teacher {
  border-color: var(--line);
  background: #fbfcfb;
}
body[data-role="student"][data-active="groups"] .group-meta .teacher b {
  color: #111827;
}
body[data-role="student"][data-active="groups"] .group-next-call-hero {
  margin-top: 16px;
  margin-bottom: 16px;
  min-height: 210px;
  border-radius: 18px;
}
body[data-role="student"][data-active="groups"] .group-next-call-hero h2 {
  color: #fff;
  margin: 6px 0 12px;
}
body[data-role="student"][data-active="groups"] .group-next-call-hero p {
  color: rgba(255,255,255,.88);
  margin: 0 0 10px;
}
body[data-role="student"][data-active="groups"] .group-next-call-hero .row-actions {
  margin-top: 14px;
}
@media (max-width: 760px) {
  body[data-role="student"][data-active="groups"] .group-meta {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  body[data-role="student"][data-active="groups"] .group-meta {
    grid-template-columns: 1fr;
  }
}

/* Step 8: student courses page only */
.student-courses-page {
  margin-top: -8px;
}
.student-courses-page .page-head {
  margin-bottom: 16px;
}
.student-courses-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.student-courses-main,
.student-courses-sidebar {
  min-width: 0;
}
.student-courses-sidebar {
  width: 100%;
  position: static;
  align-content: start;
}
.student-course-tabs {
  margin-bottom: 14px;
}
.student-course-list {
  display: grid;
  gap: 16px;
}
.student-course-card {
  grid-template-columns: 240px minmax(0, 1fr) 250px;
  gap: 22px;
  align-items: stretch;
  overflow: hidden;
}
.student-course-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.student-course-card > img {
  width: 100%;
  min-height: 170px;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
  align-self: stretch;
}
.student-course-card .student-course-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.student-course-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.student-course-title h2 {
  margin: 0;
  min-width: 0;
}
.course-progress-block {
  display: grid;
  gap: 8px;
  padding: 12px 0 2px;
}
.course-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}
.course-progress-head span {
  color: var(--muted);
  font-weight: 700;
}
.course-progress-head strong {
  margin: 0;
  line-height: 1;
}
.course-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.course-actions .btn {
  min-height: 42px;
}
.student-courses-sidebar .panel.centered {
  text-align: center;
}
.student-courses-sidebar .ring {
  margin-left: auto;
  margin-right: auto;
}
.student-courses-sidebar .ring strong,
.student-courses-sidebar .ring span {
  text-align: center;
}
.student-courses-sidebar .legend {
  width: 100%;
}
.student-program-list .module-summary {
  grid-template-columns: 48px minmax(0, 1fr) 220px 100px 120px;
  gap: 16px;
  align-items: center;
}
.student-program-list .module-summary > div {
  min-width: 0;
}
.student-program-list .module-summary h3,
.student-program-list .module-summary p {
  overflow-wrap: anywhere;
}
.student-program-list .round-btn {
  width: 100%;
  min-width: 96px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--green);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.student-program-list .round-btn:hover {
  border-color: rgba(34, 122, 55, .32);
  background: rgba(34, 122, 55, .06);
}
.sidebar {
  padding-bottom: 96px;
}
@media (max-width: 1200px) {
  .student-courses-layout,
  .student-course-card {
    grid-template-columns: 1fr;
  }
  .student-courses-sidebar {
    order: 2;
  }
  .student-course-card .course-meta {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .student-program-list .module-summary {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .student-program-list .module-stat,
  .student-program-list .round-btn {
    grid-column: 1 / -1;
  }
  .student-program-list .round-btn {
    justify-self: stretch;
  }
}
@media (max-width: 640px) {
  .student-course-card .course-meta {
    grid-template-columns: 1fr;
  }
  .course-actions {
    flex-direction: column;
  }
  .course-actions .btn {
    width: 100%;
  }
}

/* Step 9: admin users page right rail overlap fix — only Администратор → Пользователи */
body[data-role="admin"] .users-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

body[data-role="admin"] .users-main {
  min-width: 0;
  overflow: hidden;
}

body[data-role="admin"] .users-page-layout > .right-rail,
body[data-role="admin"] .users-page-layout > .users-sidebar {
  position: static;
  width: 300px;
  max-width: 300px;
  min-width: 0;
  z-index: 1;
  align-self: start;
}

body[data-role="admin"] .admin-users-panel {
  overflow-x: auto;
  overflow-y: visible;
}

body[data-role="admin"] .admin-user-row {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body[data-role="admin"] .admin-user-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

body[data-role="admin"] .admin-user-row.all {
  grid-template-columns: minmax(120px, 1.15fr) minmax(145px, 1.15fr) 78px minmax(105px, .9fr) 96px 104px minmax(220px, 1fr);
  min-width: 900px;
}

body[data-role="admin"] .admin-user-row.student {
  grid-template-columns: minmax(112px, 1fr) minmax(130px, 1fr) minmax(88px, .75fr) minmax(110px, .85fr) minmax(108px, .8fr) 88px minmax(100px, .85fr) 96px minmax(300px, 1.25fr);
  min-width: 1180px;
}

body[data-role="admin"] .admin-user-row.teacher {
  grid-template-columns: minmax(112px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(96px, .8fr) 58px 58px 64px 86px minmax(260px, 1.1fr);
  min-width: 1020px;
}

body[data-role="admin"] .admin-user-row.admin {
  grid-template-columns: minmax(125px, 1fr) minmax(145px, 1fr) 104px minmax(130px, 1fr) 104px 86px minmax(220px, 1fr);
  min-width: 860px;
}

body[data-role="admin"] .admin-user-row .user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  align-self: center;
}

body[data-role="admin"] .admin-user-row .user-actions .btn {
  width: auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
  line-height: 1.2;
}

body[data-role="admin"] .admin-user-row:not(.header) {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}

body[data-role="admin"] .admin-user-row:not(.header):hover {
  position: relative;
  z-index: 2;
  transform: translateY(-2px);
  background: #f7fbf8;
  box-shadow: 0 14px 26px rgba(17, 54, 31, .1);
  border-bottom-color: transparent;
}

body[data-role="admin"] .admin-user-row:not(.header):hover + .admin-user-row {
  border-top-color: transparent;
}

body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header):hover {
  background: rgba(255, 255, 255, .055);
  box-shadow: 0 16px 30px rgba(0, 0, 0, .24);
}

body[data-role="admin"] .user-filter-grid {
  grid-template-columns: repeat(5, minmax(110px, 1fr)) minmax(190px, 1.35fr);
}

body[data-role="admin"] .users-page-layout .right-rail .panel {
  width: 100%;
  box-sizing: border-box;
}

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

  body[data-role="admin"] .users-page-layout > .right-rail,
  body[data-role="admin"] .users-page-layout > .users-sidebar {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 900px) {
  body[data-role="admin"] .user-filter-grid,
  body[data-role="admin"] .admin-user-row.all,
  body[data-role="admin"] .admin-user-row.student,
  body[data-role="admin"] .admin-user-row.teacher,
  body[data-role="admin"] .admin-user-row.admin {
    grid-template-columns: 1fr;
  }
}

/* Step 11: admin users filters — fix working filters and select arrow alignment only */
body[data-role="admin"] .user-filter-grid {
  display: grid;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

body[data-role="admin"] .user-filter-grid[data-users-tab="all"] {
  grid-template-columns: repeat(5, minmax(120px, 1fr)) minmax(220px, 1.35fr);
}

body[data-role="admin"] .user-filter-grid[data-users-tab="student"] {
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(240px, 1.45fr);
}

body[data-role="admin"] .user-filter-grid[data-users-tab="teacher"] {
  grid-template-columns: repeat(3, minmax(150px, 1fr)) minmax(260px, 1.5fr);
}

body[data-role="admin"] .user-filter-grid[data-users-tab="admin"] {
  grid-template-columns: minmax(160px, 220px) minmax(280px, 1fr);
}

body[data-role="admin"] .user-filter-grid select,
body[data-role="admin"] .user-filter-grid input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body[data-role="admin"] .user-filter-grid select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #667166 50%), linear-gradient(135deg, #667166 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-role="admin"] .user-filter-grid select::-ms-expand {
  display: none;
}

@media (max-width: 1380px) {
  body[data-role="admin"] .user-filter-grid[data-users-tab="all"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="student"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="teacher"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="admin"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body[data-role="admin"] .user-filter-grid[data-users-tab="all"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="student"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="teacher"],
  body[data-role="admin"] .user-filter-grid[data-users-tab="admin"] {
    grid-template-columns: 1fr;
  }
}


/* Step fix 2026-06-13: support ticket drawer close button and summary layout */
.ticket-drawer .drawer-close[data-close-ticket-drawer] {
  cursor: pointer;
  z-index: 3;
}

.ticket-drawer .ticket-detail-summary {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  align-items: stretch;
}

.ticket-drawer .ticket-detail-summary span {
  min-width: 0;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: anywhere;
}

.ticket-drawer .ticket-detail-summary b,
.ticket-drawer .ticket-detail-summary small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ticket-drawer .ticket-detail-summary small {
  font-size: 12px;
}

/* Step fix 2026-06-13: sidebar logout + profile security spacing */
.sidebar-logout {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 7px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .92);
  text-align: left;
  font-weight: 750;
}
.sidebar-logout:hover {
  background: rgba(220, 70, 70, .18);
  border-color: rgba(255, 130, 130, .36);
  color: #fff;
}
.sidebar-logout .icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 6px;
  font-size: 14px;
}
.profile-security-panel {
  overflow: hidden;
}
.profile-security-panel .profile-security-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.profile-security-panel .profile-security-stats span {
  min-width: 0;
  box-sizing: border-box;
}
.profile-security-panel .profile-security-button {
  margin-top: 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}
@media (max-width: 900px) {
  .profile-security-panel .profile-security-stats {
    grid-template-columns: 1fr;
  }
}

/* Step 15: global standard app width — remove page-level horizontal scroll */
html,
body,
#app {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.shell {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  grid-template-columns: 240px minmax(0, 1fr);
  overflow-x: hidden;
}

.shell.compact-sidebar {
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar,
.main,
.topbar,
.content {
  min-width: 0;
  max-width: 100%;
}

.main,
.content {
  width: 100%;
  overflow-x: hidden;
}

.content {
  padding-left: 24px;
  padding-right: 24px;
}

.topbar {
  grid-template-columns: auto minmax(260px, 500px) auto auto;
  overflow: hidden;
}

.topbar.has-page-title {
  grid-template-columns: auto minmax(0, 1fr) minmax(260px, 500px) auto auto;
}

.topbar-page-title,
.top-search,
.profile-chip,
.profile-chip span,
.page-head,
.content > *,
.panel,
.main-column,
.right-rail {
  min-width: 0;
  max-width: 100%;
}

.topbar-page-title strong,
.topbar-page-title small,
.profile-chip strong,
.profile-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid,
.profile-role-layout,
.student-courses-layout,
.users-page-layout,
.teacher-students-layout,
.teacher-homeworks-layout,
.admin-groups-layout,
.calls-layout,
.progress-layout,
.plots-layout {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dashboard-grid,
.profile-role-layout,
.student-courses-layout,
.teacher-students-layout,
.teacher-homeworks-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 20px;
}

.right-rail,
.student-courses-sidebar,
.teacher-students-sidebar,
.teacher-homeworks-sidebar,
.profile-role-rail,
.users-page-layout > .right-rail,
.users-page-layout > .users-sidebar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  position: static;
}

.table-panel,
.admin-users-panel,
.users-main,
.docs-panel,
.lesson-admin-list,
.homework-review-list,
.student-course-list,
.student-program-list,
.groups-grid,
.admin-groups-grid,
.community-list,
.notification-list,
.progress-main {
  min-width: 0;
  max-width: 100%;
}

.table-panel,
.admin-users-panel,
.docs-panel,
.lesson-admin-list,
.homework-review-list {
  overflow-x: auto;
  overflow-y: visible;
}

.panel > *,
.field,
.field input,
.field select,
.field textarea,
.search,
.filters input,
.filters select,
.user-filter-grid,
.user-filter-grid input,
.user-filter-grid select {
  max-width: 100%;
  min-width: 0;
}

.btn,
button,
select,
input,
textarea {
  max-width: 100%;
}

@media (max-width: 1380px) {
  .dashboard-grid,
  .profile-role-layout,
  .student-courses-layout,
  .teacher-students-layout,
  .teacher-homeworks-layout,
  body[data-role="admin"] .users-page-layout {
    grid-template-columns: 1fr;
  }

  .right-rail,
  .student-courses-sidebar,
  .teacher-students-sidebar,
  .teacher-homeworks-sidebar,
  .profile-role-rail,
  body[data-role="admin"] .users-page-layout > .right-rail,
  body[data-role="admin"] .users-page-layout > .users-sidebar {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 1100px) {
  .shell,
  .shell.compact-sidebar {
    grid-template-columns: 1fr;
  }

  .content {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 760px) {
  .topbar,
  .topbar.has-page-title {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .topbar-page-title {
    display: none;
  }
}

/* Step fix 2026-06-13: profile mentor card buttons stay inside card */
.profile-role-rail .mentor-card .row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

.profile-role-rail .mentor-card .row-actions .btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .profile-role-rail .mentor-card .row-actions {
    grid-template-columns: 1fr;
  }
}

/* Step fix 2026-06-13: profile mentor buttons actually apply to student profile right rail */
.profile-role-layout > .right-rail .mentor-card .row-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.profile-role-layout > .right-rail .mentor-card .row-actions .btn {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.profile-role-layout > .right-rail .mentor-card,
.profile-role-layout > .right-rail .mentor-card * {
  box-sizing: border-box;
}

/* Step fix 2026-06-13: create group without preselected students */
.group-modal .group-create-empty-notice {
  grid-column: 1 / -1;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.group-modal .field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-modal .field,
.group-modal .student-checks,
.group-modal .student-checks label {
  min-width: 0;
}

.group-modal .student-checks label {
  overflow-wrap: anywhere;
}

/* Step 19: admin settings tariffs + safe tariff fields */
.settings-layout,
.settings-main,
.settings-tariffs-panel {
  min-width: 0;
}

.settings-tariff-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 12px;
  margin: 14px 0 16px;
}

.settings-tariff-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-tariff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 110px 90px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  min-width: 0;
}

.settings-tariff-row > * {
  min-width: 0;
}

.settings-tariff-row strong {
  display: block;
  margin-bottom: 4px;
}

.settings-tariff-row span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.settings-tariff-row b {
  white-space: nowrap;
}

.settings-tariff-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 150px 150px minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.settings-tariff-form > * {
  min-width: 0;
}

.settings-tariff-form .btn {
  min-height: 44px;
  white-space: nowrap;
}

.group-modal select,
.settings-tariffs-panel select,
.settings-tariffs-panel input {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1200px) {
  .settings-tariff-form,
  .settings-tariff-row {
    grid-template-columns: 1fr;
  }

  .settings-tariff-toolbar {
    grid-template-columns: 1fr;
  }

  .settings-tariff-form .btn {
    width: 100%;
  }
}

/* Step 21: separate admin tariffs page */
.tariffs-layout,
.tariffs-main,
.admin-tariffs-panel,
.admin-tariff-form-panel {
  min-width: 0;
}

.admin-tariff-list {
  min-width: 0;
}

.admin-tariff-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(120px, .85fr) 110px 100px 90px minmax(150px, auto);
}

.admin-tariff-row .tariff-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.admin-tariff-row .tariff-actions .btn {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 13px;
}

.admin-tariff-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-tariff-form .btn {
  min-height: 44px;
}

.admin-tariff-form button[data-save-settings-tariff] {
  grid-column: auto;
}

.admin-tariff-form button[data-cancel-settings-tariff-edit] {
  grid-column: auto;
}

.admin-tariff-form select,
.admin-tariff-form input {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1280px) {
  .admin-tariff-row,
  .admin-tariff-form {
    grid-template-columns: 1fr;
  }

  .admin-tariff-row .tariff-actions {
    justify-content: stretch;
  }

  .admin-tariff-row .tariff-actions .btn,
  .admin-tariff-form .btn {
    width: 100%;
  }
}

/* Step 22: admin courses header/right stat/edit button fix */
body[data-role="admin"][data-active="courses"] .content {
  padding-top: 18px;
}
body[data-role="admin"][data-active="courses"] .admin-courses-layout {
  align-items: start;
}
body[data-role="admin"][data-active="courses"] .course-admin-row {
  grid-template-columns: minmax(220px, 1fr) 110px 110px minmax(300px, auto);
  gap: 14px;
  min-width: 0;
}
body[data-role="admin"][data-active="courses"] .course-admin-row > * {
  min-width: 0;
}
body[data-role="admin"][data-active="courses"] .course-admin-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
body[data-role="admin"][data-active="courses"] .course-admin-actions .btn {
  min-height: 40px;
  padding: 9px 14px;
  white-space: nowrap;
}
body[data-role="admin"][data-active="courses"] .right-rail .stats-mini {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1180px) {
  body[data-role="admin"][data-active="courses"] .course-admin-row {
    grid-template-columns: 1fr;
  }
  body[data-role="admin"][data-active="courses"] .course-admin-actions {
    justify-content: stretch;
  }
  body[data-role="admin"][data-active="courses"] .course-admin-actions .btn {
    flex: 1 1 120px;
  }
}

/* Step 23: structured document base */
.docs-view-tabs {
  margin: 0 0 14px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.docs-structure-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
}

.docs-structure-filters .field {
  margin: 0;
  min-width: 0;
}

.docs-structure-filters select,
.course-modal select[data-doc-module],
.course-modal select[data-doc-lesson] {
  width: 100%;
  min-width: 0;
}

.doc-relation {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf8;
  color: #4c5850;
  font-size: 12px;
  line-height: 1.35;
}

.doc-relation span {
  overflow-wrap: anywhere;
}

.doc-file-field input[type="file"] {
  width: 100%;
  max-width: 100%;
}

.doc-file-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf8;
  font-size: 13px;
  color: #4c5850;
  overflow-wrap: anywhere;
}

.doc-structure-fields {
  display: contents;
}

.doc-optional-structure {
  display: grid;
  gap: 6px;
}

.doc-bind-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.doc-bind-toggle input {
  width: auto;
  margin: 0;
}

.doc-scope-field[hidden],
.doc-structure-fields[hidden],
.doc-optional-structure[hidden] {
  display: none !important;
}

.doc-category-custom {
  margin-top: 8px;
}

.doc-category-custom[hidden] {
  display: none !important;
}

.course-modal select[data-doc-category-select] {
  width: 100%;
  min-width: 0;
}

.doc-current-file {
  margin-top: 8px;
}

.docs-structure {
  display: grid;
  gap: 16px;
}

.docs-structure-course {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.docs-module-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfb;
}

.docs-module-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.docs-module-title strong {
  display: block;
  font-size: 16px;
}

.docs-module-title span:not(.badge) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.docs-structure-list {
  display: grid;
  gap: 8px;
}

.doc-structure-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.doc-structure-row > div:nth-child(2) {
  min-width: 0;
}

.doc-structure-row strong,
.doc-structure-row span {
  display: block;
  overflow-wrap: anywhere;
}

.doc-structure-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.small-doc-icon {
  width: 44px;
  height: 44px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .docs-structure-filters {
    grid-template-columns: 1fr;
  }
  .docs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .docs-grid {
    grid-template-columns: 1fr;
  }
  .docs-module-title,
  .doc-structure-row {
    grid-template-columns: 1fr;
  }
  .doc-structure-row .btn {
    width: 100%;
  }
}

/* Step 24: admin docs title moved into topbar */
body[data-role="admin"][data-active="docs"] .content {
  padding-top: 18px;
}

body[data-role="admin"][data-active="docs"] .docs-upload-head {
  justify-content: flex-end;
  align-items: center;
  margin: 0 0 14px;
}

body[data-role="admin"][data-active="docs"] .docs-upload-head > div {
  display: none;
}

body[data-role="admin"][data-active="docs"] .docs-upload-head .btn {
  min-width: 176px;
}

@media (max-width: 760px) {
  body[data-role="admin"][data-active="docs"] .docs-upload-head .btn {
    width: 100%;
  }
}

/* Step 25: admin home title moved into topbar */
body[data-role="admin"][data-active="home"] .content {
  padding-top: 18px;
}

body[data-role="admin"][data-active="home"] .admin-home-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 0 0 14px;
  min-width: 0;
}

body[data-role="admin"][data-active="home"] .admin-home-actions .btn {
  min-width: 220px;
}

@media (max-width: 760px) {
  body[data-role="admin"][data-active="home"] .admin-home-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Step 26: page titles moved to topbar across all roles */
body[data-active] .content {
  padding-top: 18px;
}

.page-head.page-head-actions-only {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  min-width: 0;
}

.page-head.page-head-actions-only > div:first-child {
  display: none;
}

.page-head.page-head-actions-only .row-actions {
  justify-content: flex-end;
  min-width: 0;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .page-head.page-head-actions-only,
  .page-head.page-head-actions-only .row-actions,
  .page-head.page-head-actions-only .btn {
    width: 100%;
  }
}

/* Step 27: fixed full-height sidebar for all roles */
@media (min-width: 1101px) {
  .shell {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 40;
    box-sizing: border-box;
    padding-bottom: 110px;
  }

  .main {
    margin-left: 240px;
    width: calc(100% - 240px);
    min-height: 100vh;
    min-height: 100dvh;
  }

  .shell.compact-sidebar .sidebar {
    width: 88px;
  }

  .shell.compact-sidebar .main {
    margin-left: 88px;
    width: calc(100% - 88px);
  }
}


/* Step 28: remove decorative settings right rail */
.settings-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}

.settings-layout .settings-main {
  width: 100%;
  max-width: 100%;
}


/* Step 29: settings cleanup + header account/notification polish */
.profile-chip,
.top-icon {
  cursor: pointer;
}

.top-icon {
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: 20px;
}

.profile-menu button[data-profile-action="logout"] {
  color: #b42318;
}

.profile-menu button[data-profile-action="logout"]:hover {
  background: #fff1f0;
  color: #b42318;
}

.settings-main > .panel:first-child {
  margin-top: 0;
}

.accent-palette-note {
  margin: 0 0 4px;
  max-width: 760px;
}

.accent-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.accent-palette-card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.accent-palette-card:hover {
  border-color: var(--accent-border);
}

.accent-palette-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.accent-palette-card strong {
  font-size: 15px;
}

.accent-palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.accent-palette-swatches i {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--swatch);
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}

body[data-theme="dark"] .accent-palette-swatches i {
  border-color: rgba(255, 255, 255, .12);
}

/* Step 31: unified semantic icons for right sidebar cards */
.right-rail .rail-row > .rail-icon,
.right-rail .notice-task > .rail-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(34, 122, 55, 0.10);
  color: var(--green);
  font-size: 16px;
  line-height: 1;
  flex: 0 0 32px;
}

.right-rail .notice-task > .rail-icon {
  grid-row: 1 / span 2;
}

.right-rail .rail-row > span:not(.avatar):not(.rail-icon),
.right-rail .notice-task > span:not(.rail-icon) {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(34, 122, 55, 0.10);
  color: var(--green);
  font-size: 16px;
  line-height: 1;
}

/* Step 32: make header profile dropdown visible and usable across all roles/pages */
.topbar {
  overflow: visible !important;
}

.profile-menu {
  position: fixed !important;
  top: 66px !important;
  right: 24px !important;
  z-index: 9999 !important;
  width: 240px;
  max-width: calc(100vw - 32px);
}

.profile-chip {
  cursor: pointer;
  flex-shrink: 0;
}

.profile-chip .avatar,
.profile-chip strong,
.profile-chip small {
  pointer-events: none;
}

/* Step 33: move call host/platform block to the right side of hero cards */
.event-hero-side {
  min-width: 190px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
}

.event-hero-side .hero-host-card {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  backdrop-filter: blur(2px);
}

.event-hero-side .hero-host-card b {
  display: block;
  color: #fff;
  line-height: 1.15;
}

.event-hero-side .hero-host-card small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, .78);
  line-height: 1.2;
}

.call-hero .event-hero-side {
  justify-items: stretch;
  align-content: center;
  min-width: 220px;
}

.call-hero .event-hero-side .row-actions {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

.call-hero .event-hero-side .row-actions .btn {
  width: 100%;
}

@media (max-width: 900px) {
  .event-hero-side,
  .call-hero .event-hero-side {
    min-width: 0;
    justify-items: stretch;
  }
  .event-hero-side .telemost-badge {
    justify-self: start;
  }
}

/* Step 34: unified role/user avatars across accounts */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  background: linear-gradient(135deg, var(--avatar-from, #dcefe1), var(--avatar-to, #aecaB7));
  color: var(--avatar-ink, #0f5f2a);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.avatar::after {
  content: attr(data-initials);
  display: block;
  letter-spacing: .02em;
}

.avatar-student { --avatar-from: #eaf5ec; --avatar-to: #b8dac2; --avatar-ink: #176b31; }
.avatar-teacher { --avatar-from: #eef6ff; --avatar-to: #b9d6ff; --avatar-ink: #185b9e; }
.avatar-admin { --avatar-from: #fff3dc; --avatar-to: #f3c56d; --avatar-ink: #8a5200; }
.avatar-current { --avatar-from: #e8f6ea; --avatar-to: #c0ddc8; --avatar-ink: #176b31; }

.small-avatar::after { font-size: 11px; }
.teacher-avatar-large .avatar::after { font-size: 22px; }
.profile-chip .avatar::after { font-size: 12px; }

[data-call-teacher-modal] .avatar,
.avatar[data-call-teacher-modal] {
  cursor: pointer;
}

.mentor-profile-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.mentor-profile-button:hover strong,
.rail-row.action-row:hover strong,
.group-teacher-strip .avatar[data-call-teacher-modal]:hover + div strong,
.plot-mentor-note .avatar[data-call-teacher-modal]:hover + div strong {
  color: var(--green);
}

.hero-host-card[data-call-teacher-modal] {
  cursor: pointer;
}

.hero-host-card[data-call-teacher-modal]:hover {
  background: rgba(255, 255, 255, .16);
}

.ticket-summary .avatar {
  vertical-align: middle;
}


/* Step 35: remove extra Telemost logo and lift call host card */
.event-hero:not(.call-hero) .event-hero-side {
  align-self: start;
  align-content: start;
  padding-top: 18px;
}

.event-hero:not(.call-hero) .event-hero-side .hero-host-card {
  max-width: 210px;
}

@media (max-width: 900px) {
  .event-hero:not(.call-hero) .event-hero-side {
    padding-top: 0;
  }
}

/* Step 36: student lessons progress alignment */
body[data-role="student"][data-active="lessons"] .lesson-module-head {
  grid-template-columns: 58px minmax(0, 1fr) 220px 112px;
  gap: 18px;
  align-items: center;
}

body[data-role="student"][data-active="lessons"] .lesson-module-head > div:nth-child(2) {
  min-width: 0;
}

body[data-role="student"][data-active="lessons"] .lesson-module-progress {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 8px;
  align-items: center;
}

body[data-role="student"][data-active="lessons"] .lesson-module-progress .module-stat-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

body[data-role="student"][data-active="lessons"] .lesson-module-progress .module-stat-top strong {
  font-size: 17px;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}

body[data-role="student"][data-active="lessons"] .lesson-module-progress .module-stat-top span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

body[data-role="student"][data-active="lessons"] .lesson-module-progress .progress {
  width: 100%;
  height: 9px;
}

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

body[data-role="student"][data-active="lessons"] .lesson-progress-card h2 {
  margin-bottom: 2px;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .ring {
  --size: 132px;
  margin: 4px auto 8px;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .ring strong {
  top: 55%;
  font-size: 28px;
  line-height: 1;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .ring span {
  top: 34%;
  width: 64px;
  font-size: 10px;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  overflow: visible;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .lesson-progress-legend {
  width: 100%;
  display: grid;
  gap: 8px;
  margin: 2px 0 0;
  text-align: left;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .lesson-progress-legend span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  line-height: 1.25;
}

body[data-role="student"][data-active="lessons"] .lesson-progress-card .btn {
  margin-top: 8px;
}

@media (max-width: 900px) {
  body[data-role="student"][data-active="lessons"] .lesson-module-head {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  body[data-role="student"][data-active="lessons"] .lesson-module-progress,
  body[data-role="student"][data-active="lessons"] .lesson-module-head .round-btn {
    grid-column: 1 / -1;
  }

  body[data-role="student"][data-active="lessons"] .lesson-module-head .round-btn {
    width: 100%;
  }
}

/* Step fix 2026-06-13: mentor card buttons never overflow in any role/page */
.right-rail .mentor-card .row-actions,
.dashboard-sidebar .mentor-card .row-actions,
.support-rail .mentor-card .row-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.right-rail .mentor-card .row-actions .btn,
.dashboard-sidebar .mentor-card .row-actions .btn,
.support-rail .mentor-card .row-actions .btn {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.right-rail .mentor-card,
.dashboard-sidebar .mentor-card,
.support-rail .mentor-card {
  overflow: hidden;
}

/* Step 39: teacher profile modal alignment */
.teacher-profile-modal .ticket-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  margin: 18px auto;
  width: 100%;
}

.teacher-profile-modal .ticket-summary span {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.teacher-profile-modal .teacher-profile-actions {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.25fr);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.teacher-profile-modal .teacher-profile-actions .btn {
  width: 100%;
  min-width: 0;
}

@media (max-width: 760px) {
  .teacher-profile-modal .ticket-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .teacher-profile-modal .teacher-profile-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .teacher-profile-modal .ticket-summary {
    grid-template-columns: 1fr;
  }
}

/* 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;
  }
}

/* Step 53: calls filters arrows and calls stats spacing */
.filters .filter,
.tabs button,
.category-pills button,
.course-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.15;
  white-space: nowrap;
  vertical-align: middle;
}

.filters .filter {
  min-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

.calls-sidebar .calls-stats-card {
  text-align: center;
}

.calls-sidebar .calls-stats-card .ring {
  margin-bottom: 18px;
}

.calls-stats-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
  width: 100%;
}

.calls-stats-list span {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  min-height: 28px;
  padding: 0 2px;
  color: var(--muted);
  border: 0;
}

.calls-stats-list i {
  font-style: normal;
  line-height: 1;
  color: var(--muted);
}

.calls-stats-list em {
  font-style: normal;
  text-align: left;
  line-height: 1.25;
  min-width: 0;
}

.calls-stats-list b {
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  min-width: 24px;
  text-align: right;
}

.calls-sidebar .calls-stats-card .btn.full {
  margin-top: 8px;
}

/* Step 54: useful calls statistics card */
.calls-sidebar .calls-summary-card {
  display: grid;
  gap: 16px;
  text-align: left;
}

.calls-sidebar .calls-summary-card h2 {
  text-align: left;
  margin-bottom: 0;
}

.calls-summary-list {
  display: grid;
  gap: 10px;
  width: 100%;
}

.calls-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 34px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}

.calls-summary-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}

.calls-summary-row b {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.calls-summary-list.compact .calls-summary-row {
  min-height: 28px;
  padding: 8px 10px;
}

.call-stats-modal {
  display: grid;
  gap: 18px;
}

.call-stats-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.call-stats-modal-grid span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbf8;
}

.call-stats-modal-grid b {
  font-size: 26px;
  line-height: 1;
}

.call-stats-modal-grid small {
  color: var(--muted);
  line-height: 1.25;
}

.call-stats-detail-block {
  display: grid;
  gap: 10px;
}

.call-stats-detail-block h3 {
  margin: 0;
}

@media (max-width: 720px) {
  .call-stats-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .call-stats-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* Step 55: linked calls statistics modal */
.call-stats-modal .section-title {
  align-items: flex-start;
}

.call-stats-modal-grid {
  align-items: stretch;
}

.call-stats-chip {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbf8;
  text-align: left;
  cursor: pointer;
}

.call-stats-chip:hover,
.call-stats-chip.active {
  border-color: rgba(31, 125, 61, .42);
  background: #eef8f0;
  box-shadow: 0 8px 18px rgba(14, 79, 45, .08);
}

.call-stats-chip b {
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
}

.call-stats-chip small {
  color: var(--muted);
  line-height: 1.25;
}

.call-stats-result-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.compact-title {
  margin-bottom: 0;
}

.call-stats-results {
  display: grid;
  gap: 10px;
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.call-stats-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.call-stats-result-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.call-stats-result-main > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.call-stats-result-main strong,
.call-stats-result-main span,
.call-stats-result-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.call-stats-result-main span,
.call-stats-result-main small {
  color: var(--muted);
  line-height: 1.28;
}

.call-stats-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.call-stats-result-actions .btn {
  min-height: 38px;
  white-space: nowrap;
}

.next-call-block .compact-row {
  align-items: center;
}

@media (max-width: 760px) {
  .call-stats-result-row,
  .call-stats-result-main {
    grid-template-columns: 1fr;
  }

  .call-stats-result-actions {
    justify-content: stretch;
  }

  .call-stats-result-actions .btn {
    flex: 1 1 150px;
  }
}

/* Step 56: linked call statistics modal and synchronized relation rows */
.call-stats-modal .call-stats-chip {
  appearance: none;
}
.call-stats-modal .call-stats-chip.active::after {
  content: "Показано ниже";
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
}
.call-stats-result-row {
  grid-template-columns: 1fr;
  align-items: stretch;
}
.call-stats-result-main {
  grid-template-columns: minmax(112px, auto) minmax(0, 1fr);
  align-items: start;
}
.call-stats-result-main .badge {
  justify-self: start;
  white-space: normal;
  max-width: 132px;
  text-align: left;
}
.call-stats-result-actions {
  justify-content: flex-start;
  padding-top: 4px;
}
.call-stats-result-actions .btn {
  flex: 0 1 auto;
  min-width: 150px;
}
@media (max-width: 760px) {
  .call-stats-result-main {
    grid-template-columns: 1fr;
  }
  .call-stats-result-main .badge {
    max-width: none;
  }
}

/* Step 57: cleaner profile photo controls, centered security stats and dynamic teacher workload */
.profile-photo-actions.compact-photo-actions {
  min-width: 188px;
  gap: 10px;
  padding: 14px 16px;
}
.profile-photo-actions.compact-photo-actions > .profile-avatar-upload {
  min-height: 44px;
  border-color: #1f7a3d;
  background: linear-gradient(180deg, #2f914c, #1f7a3d);
  color: #fff;
}
.profile-photo-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.profile-photo-secondary-actions .btn {
  min-height: 40px;
  padding: 9px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.profile-photo-secondary-actions .btn:disabled,
.profile-photo-actions .btn:disabled {
  opacity: .48;
  cursor: not-allowed;
}
.profile-security-panel .profile-security-stats span,
.teacher-load-card .stats-mini span {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
}
.profile-security-panel .profile-security-stats b,
.teacher-load-card .stats-mini b {
  line-height: 1.05;
  text-align: center;
}
.teacher-load-card {
  text-align: left;
}
.teacher-load-card h2 {
  text-align: left;
}
.teacher-load-card .teacher-load-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}
.teacher-load-card .teacher-load-stats span {
  min-width: 0;
  min-height: 74px;
  line-height: 1.25;
}
.teacher-load-card .teacher-load-stats b {
  font-size: 19px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.teacher-load-extra {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.teacher-load-extra span {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.teacher-load-extra b {
  color: var(--ink);
}
.small-note,
.mentor-response-note {
  font-size: 12px;
  line-height: 1.45;
}
.teacher-load-card .badge {
  margin-top: 10px;
}
.mentor-response-note {
  margin-top: -4px;
  color: var(--muted);
}
@media (max-width: 900px) {
  .profile-photo-secondary-actions,
  .teacher-load-card .teacher-load-stats,
  .teacher-load-extra {
    grid-template-columns: 1fr;
  }
}

/* Step fix 2026-06-14: teacher student drawer close and progress spacing */
.student-drawer-overlay {
  cursor: pointer;
}
.student-drawer {
  cursor: default;
}
.student-drawer .drawer-close[data-close-student-drawer] {
  cursor: pointer;
  z-index: 4;
}
.student-drawer-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.student-drawer-progress-panel {
  display: grid;
  gap: 18px;
}
.student-drawer-stats {
  margin: 0;
}
.student-drawer-progress-block {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}
.student-drawer-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--green);
  font-weight: 800;
}
.student-drawer-progress-block .progress {
  width: 100%;
  margin: 0;
}
.student-drawer-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  align-items: center;
  gap: 12px;
}
.student-drawer-actions .btn {
  flex: 0 1 150px;
  min-height: 44px;
}
@media (max-width: 760px) {
  .student-drawer-actions {
    grid-template-columns: 1fr;
    display: grid;
  }
  .student-drawer-actions .btn {
    width: 100%;
    flex-basis: auto;
  }
}

/* Step 121: student drawer info cards — long email/course text wrap */
.student-drawer .ticket-detail,
.student-drawer .student-drawer-body {
  min-width: 0;
  max-width: 100%;
}
.student-drawer .ticket-summary {
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.student-drawer .ticket-summary > span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
  height: auto;
  min-height: 78px;
}
.student-drawer .ticket-summary > span > b {
  overflow-wrap: normal;
  word-break: normal;
}
.student-drawer-progress-head strong {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media (max-width: 760px) {
  .student-drawer .ticket-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .student-drawer .ticket-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Step 59: admin teacher creation without group binding + teacher profile card editing */
.user-modal-note {
  border: 1px dashed #cfdad3;
  background: #f5fbf6;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 12px 14px;
}

.profile-photo-panel {
  align-items: center;
}

.profile-photo-actions.compact-photo-actions {
  min-width: 210px;
  max-width: 230px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.profile-photo-actions.compact-photo-actions > .profile-avatar-upload {
  width: 100%;
  min-height: 42px;
}

.profile-photo-secondary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-photo-secondary-actions .btn {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
}

.teacher-form .field.full-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.teacher-public-card-preview .preview-row {
  margin: 10px 0 12px;
}

.teacher-public-card-preview p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.mentor-card-description {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .profile-photo-actions.compact-photo-actions {
    max-width: none;
    width: 100%;
    justify-self: stretch;
  }
}

/* Step 60: admin users open card, archive and delete actions */
.user-archive-tabs {
  margin-top: -6px;
  margin-bottom: 0;
}
.user-modal-actions {
  align-items: center;
  gap: 10px;
}
.user-modal-actions .push-right {
  margin-left: auto;
}
.danger-note {
  border-color: #f1c5c0;
  background: #fff7f6;
  color: #8f1e18;
}
.admin-user-drawer {
  width: min(680px, 52vw);
}
.admin-user-drawer .ticket-detail {
  display: grid;
  gap: 16px;
}
.admin-user-drawer-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbf8;
}
.admin-user-drawer-top strong,
.admin-user-drawer-top span {
  display: block;
}
.admin-user-drawer-top span {
  margin-top: 4px;
  color: var(--muted);
}
.admin-user-drawer-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.admin-user-drawer-detail .user-detail-card {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.admin-user-drawer-detail .user-detail-card > .section-title {
  display: none;
}
.admin-user-drawer-detail .user-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 980px) {
  .admin-user-drawer { width: 100vw; }
  .admin-user-drawer-grid,
  .admin-user-drawer-detail .user-detail-grid {
    grid-template-columns: 1fr;
  }
  .user-modal-actions .push-right {
    margin-left: 0;
  }
}

/* Step 61: admin users roles, student level/access separation and recent changes cleanup */
body[data-role="admin"] .admin-user-row.all {
  grid-template-columns: minmax(140px, 1fr) minmax(155px, 1fr) 118px minmax(120px, .9fr) 140px 108px minmax(220px, 1fr);
}
body[data-role="admin"] .admin-user-row.teacher {
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(120px, .9fr) 64px 64px 70px 96px minmax(260px, 1.1fr);
}
body[data-role="admin"] .admin-user-row.admin {
  grid-template-columns: minmax(135px, 1fr) minmax(150px, 1fr) 118px minmax(130px, 1fr) 108px 96px minmax(220px, 1fr);
}
.role-badge,
.student-level-badge,
.access-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}
.role-badge {
  color: #17542b;
  background: #edf8ef;
  border: 1px solid #cbe8d2;
}
.role-badge.role-teacher {
  color: #174a73;
  background: #eef6ff;
  border-color: #cfe2f6;
}
.role-badge.role-admin {
  color: #6b4a12;
  background: #fff7df;
  border-color: #f1dfac;
}
.student-level-badge {
  color: #543f9b;
  background: #f1edff;
  border: 1px solid #ddd3ff;
}
.access-badge.active {
  color: #1f7a3a;
  background: #e8f7ec;
  border: 1px solid #c9e8d0;
}
.access-badge.blocked {
  color: #9a271f;
  background: #fff1ef;
  border: 1px solid #f0c3bd;
}
.user-status-stack {
  display: grid;
  gap: 6px;
  justify-items: start;
  align-content: center;
  min-width: 0;
}
.user-status-stack small {
  margin: 0;
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
}
.admin-user-row .badge,
.admin-user-row .role-badge,
.admin-user-row .student-level-badge,
.admin-user-row .access-badge {
  overflow-wrap: normal;
  word-break: keep-all;
}
.admin-audit-card {
  max-height: 290px;
  overflow: hidden;
}
.admin-audit-list {
  display: grid;
  gap: 8px;
  max-height: 218px;
  overflow: auto;
  padding-right: 4px;
}
.admin-audit-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid #eef1ee;
}
.admin-audit-item:last-child {
  border-bottom: 0;
}
.admin-audit-item span {
  color: var(--green);
  font-weight: 900;
}
.admin-audit-item p {
  margin: 0;
  line-height: 1.28;
  color: #202820;
  font-size: 14px;
}
@media (max-width: 1500px) {
  body[data-role="admin"] .admin-user-row.all,
  body[data-role="admin"] .admin-user-row.teacher,
  body[data-role="admin"] .admin-user-row.admin {
    min-width: 0;
    grid-template-columns: 1fr;
  }
  body[data-role="admin"] .admin-user-row.student {
    min-width: 0;
    grid-template-columns: 1fr;
  }
  body[data-role="admin"] .admin-user-row .user-actions {
    justify-content: flex-start;
  }
  .user-status-stack {
    justify-items: start;
  }
}

/* Step 62: student progress is tied to course modules and lessons */
.next-status span.done {
  background: #e8f5ec;
  color: var(--green);
}
.achievement small {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}
.progress-module-row .module-title span {
  overflow-wrap: anywhere;
}

/* Step 63: student statuses modal tied to modules/lessons/progress */
/* Step 114: student statuses modal readability and course scope */
.student-statuses-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.student-statuses-modal {
  width: min(960px, calc(100% - 40px));
  max-height: calc(100vh - 80px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  color: var(--ink);
}

.student-status-course-label {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--green);
}

.student-status-lead {
  margin: 0;
  color: var(--muted);
  max-width: 56ch;
}

.student-statuses-modal .modal-x {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--green);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.student-statuses-modal .modal-x:hover {
  background: rgba(34, 122, 55, .08);
}

.modal-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-right: 42px;
  margin-bottom: 18px;
}

.modal-headline h2 {
  margin: 0 0 6px;
}

.modal-headline p {
  margin: 0;
  color: var(--muted);
}

.status-progress-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.status-progress-summary span {
  min-height: 84px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.status-progress-summary b {
  font-size: 24px;
  color: var(--green);
  line-height: 1;
}

.status-progress-summary small {
  color: var(--muted);
  line-height: 1.25;
}

.student-status-list {
  display: grid;
  gap: 12px;
}

.student-status-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.student-status-card.current {
  border-color: rgba(34, 122, 55, .45);
  background: #f3fbf5;
  box-shadow: 0 0 0 1px rgba(34, 122, 55, .08);
}

.student-status-card.passed {
  background: #f8fcf9;
}

.student-status-card.locked {
  background: #fafbfb;
  opacity: 1;
}

.student-status-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.student-status-card-head strong {
  display: block;
  font-size: 20px;
}

.student-status-card-head small,
.student-status-card .module-hint {
  color: var(--muted);
}

.student-status-card p {
  margin: 0;
  color: var(--ink);
}

.status-state {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef7ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.student-status-card.locked .status-state {
  background: #f3f4f4;
  color: var(--muted);
}

.student-status-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.status-check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.status-check span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f0f3f0;
  color: var(--muted);
  font-weight: 800;
}

.status-check.done span {
  background: #e8f6ea;
  color: var(--green);
}

.status-check strong {
  min-width: 0;
  font-size: 14px;
}

.status-check em {
  font-style: normal;
  color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}

.status-modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

body[data-theme="dark"] .student-statuses-backdrop {
  background: rgba(0, 0, 0, 0.65);
}

body[data-theme="dark"] .student-statuses-modal {
  background: #17221d;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

body[data-theme="dark"] .student-statuses-modal .status-progress-summary span,
body[data-theme="dark"] .student-statuses-modal .student-status-card,
body[data-theme="dark"] .student-statuses-modal .status-check {
  background: #1e2b24;
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

body[data-theme="dark"] .student-statuses-modal .student-status-card.current {
  background: linear-gradient(135deg, rgba(79, 186, 105, 0.12), #1e2b24 58%);
  border-color: rgba(88, 185, 108, 0.34);
}

body[data-theme="dark"] .student-statuses-modal .student-status-card.passed {
  background: #1a2620;
}

body[data-theme="dark"] .student-status-course-label {
  color: #7fd792;
}

@media (max-width: 900px) {
  .status-progress-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .student-status-checks {
    grid-template-columns: 1fr;
  }
  .student-status-card-head,
  .modal-headline {
    align-items: stretch;
    flex-direction: column;
  }
  .status-check {
    grid-template-columns: 24px minmax(0, 1fr);
  }
  .status-check em {
    grid-column: 2;
  }
}

/* Step 64: student homework right rail fixes */
body[data-role="student"][data-active="homework"] .homework-module-progress {
  overflow: hidden;
}
body[data-role="student"][data-active="homework"] .homework-progress-legend {
  gap: 12px;
  margin: 12px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
body[data-role="student"][data-active="homework"] .homework-progress-legend span {
  min-height: 26px;
  align-items: center;
  padding: 2px 0;
}
body[data-role="student"][data-active="homework"] .homework-module-progress .btn.full {
  margin-top: 4px;
}
.homework-hints-card {
  display: grid;
  gap: 10px;
}
.homework-hints-card h2 {
  margin-bottom: 2px;
}
.hint-action {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
}
.hint-action:hover {
  border-color: rgba(39, 127, 62, .35);
  background: #f6fbf7;
}
.hint-action span {
  min-width: 0;
}
body[data-role="student"][data-active="homework"] .ask-card .ask-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
body[data-role="student"][data-active="homework"] .ask-card .ask-card-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.homework-hint-backdrop {
  place-items: start center;
  padding: 72px 18px;
}
.homework-hint-modal {
  position: relative;
  width: min(680px, calc(100vw - 36px));
  max-width: 680px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(7, 20, 15, .28);
  overflow: hidden;
}
.homework-hint-modal .modal-x {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}
.homework-hint-modal .modal-x:hover {
  background: #f3f8f4;
  color: var(--green);
}
.homework-hint-modal .modal-headline {
  padding-right: 48px;
  margin-bottom: 16px;
}
.homework-hint-modal .modal-headline h2 {
  margin: 0 0 8px;
  line-height: 1.15;
}
.homework-hint-modal .modal-headline p {
  max-width: 560px;
  line-height: 1.45;
}
.hint-modal-text {
  margin: 14px 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(36, 115, 56, .12);
  border-radius: 14px;
  background: #f6fbf7;
  color: var(--ink);
  line-height: 1.55;
}
.hint-modal-steps {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.hint-modal-steps div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf8;
}
.hint-modal-steps span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}
.hint-modal-steps strong {
  min-width: 0;
  font-size: 14px;
}
@media (max-width: 900px) {
  .homework-hint-backdrop {
    padding: 48px 12px;
  }
  .homework-hint-modal {
    width: min(680px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    padding: 20px;
  }
}

/* Step 66: Yandex Disk call records and student calls rail fixes */
body[data-role="student"][data-active="calls"] .ask-card .ask-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
body[data-role="student"][data-active="calls"] .ask-card .ask-card-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.record-link-modal .record-storage-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 125, 61, .22);
  border-radius: 14px;
  background: #f3fbf5;
  line-height: 1.35;
}
.record-link-modal .record-storage-note strong {
  color: var(--ink);
}
.record-link-modal .record-storage-note span {
  color: var(--muted);
  font-size: 14px;
}
.call-row.with-recording {
  background: linear-gradient(90deg, rgba(31, 125, 61, .035), transparent 45%);
  border-radius: 14px;
  padding-left: 10px;
  padding-right: 10px;
}
.call-stats-result-row .btn.secondary[data-open-record]::after,
.call-row .btn.secondary[data-open-record]::after {
  content: "";
}
.calls-summary-card .calls-summary-row b {
  max-width: 120px;
  overflow-wrap: anywhere;
}
@media (max-width: 1320px) {
  .call-row {
    grid-template-columns: 42px minmax(220px, 1fr) 120px minmax(120px, auto);
  }
  .call-row > .badge,
  .call-row > span:nth-of-type(2) {
    justify-self: start;
  }
  .call-row-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

/* Step 67: student courses progress/calls rail cleanup */
body[data-role="student"][data-active="courses"] .course-progress-rail-card {
  text-align: center;
  overflow: hidden;
}
body[data-role="student"][data-active="courses"] .course-progress-rail-card .ring {
  --size: 118px;
  margin: 8px auto 18px;
}
body[data-role="student"][data-active="courses"] .course-progress-rail-card .ring strong {
  top: 47%;
  font-size: 28px;
}
body[data-role="student"][data-active="courses"] .course-progress-rail-card .ring span {
  top: 64%;
  width: 70%;
  font-size: 10px;
  line-height: 1.12;
  letter-spacing: -.01em;
}
.course-progress-rail-list {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 0 0 14px;
}
.course-progress-rail-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdfb;
  box-sizing: border-box;
}
.course-progress-rail-list span {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  line-height: 1.2;
}
.course-progress-rail-list b {
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
  text-align: right;
}
.course-progress-rail-actions {
  display: grid;
  gap: 10px;
  width: 100%;
}
body[data-role="student"] .right-rail .ask-card .ask-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
body[data-role="student"] .right-rail .ask-card .ask-card-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
body[data-role="student"] .student-course-card .course-progress-head {
  align-items: center;
}
body[data-role="student"] .student-course-card .course-progress-head strong {
  font-size: 28px;
  color: var(--ink);
}
body[data-role="student"] .student-course-card .course-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Step 68: day/evening theme toggle across all accounts */
body[data-theme="dark"] {
  --ink: #e9f0ea;
  --muted: #a8b4ad;
  --soft: #1d2822;
  --soft-green: #20392a;
  --line: rgba(228, 238, 230, .14);
  --panel: #17221d;
  --green: #58b96c;
  --green-dark: #071010;
  --green-2: #6ac87b;
  --amber: #f2b457;
  --blue: #75aef4;
  --red: #ff7676;
  --violet: #a99cff;
  --bg: #101713;
  --shadow: 0 20px 48px rgba(0, 0, 0, .28);
  background:
    radial-gradient(circle at 28% 0%, rgba(49, 126, 72, .13), transparent 30%),
    linear-gradient(180deg, #111a16, #0f1512 52%, #101713);
  color: var(--ink);
  color-scheme: dark;
}

.theme-toggle {
  min-width: 74px;
  height: 38px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(15, 28, 22, .08);
}

.theme-toggle span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  opacity: .55;
  transition: background .18s ease, opacity .18s ease, transform .18s ease;
}

.theme-toggle span.active {
  background: var(--green);
  color: #fff;
  opacity: 1;
  transform: scale(1.02);
}

.topbar {
  grid-template-columns: auto minmax(260px, 500px) auto auto auto !important;
}

.topbar.has-page-title {
  grid-template-columns: auto minmax(0, 1fr) minmax(260px, 500px) auto auto auto !important;
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(31, 43, 36, .92);
  border-color: rgba(222, 238, 225, .16);
  box-shadow: 0 10px 28px rgba(0,0,0,.26);
}

body[data-theme="dark"] .topbar {
  background: rgba(17, 25, 21, .92) !important;
  border-bottom-color: var(--line);
  box-shadow: 0 14px 34px rgba(0,0,0,.16);
}

body[data-theme="dark"] .main,
body[data-theme="dark"] .content,
body[data-theme="dark"] .shell {
  background: transparent;
}

body[data-theme="dark"] .sidebar {
  background:
    radial-gradient(circle at 68% 8%, rgba(62, 153, 82, .20), transparent 28%),
    linear-gradient(180deg, #050d0f, #071315 58%, #050b0d);
}

body[data-theme="dark"] .topbar-page-title strong,
body[data-theme="dark"] .page-head h1,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] strong {
  color: var(--ink);
}

body[data-theme="dark"] .topbar-page-title small,
body[data-theme="dark"] .page-head p,
body[data-theme="dark"] small,
body[data-theme="dark"] .muted,
body[data-theme="dark"] .role-note,
body[data-theme="dark"] .field label,
body[data-theme="dark"] .profile-chip small {
  color: var(--muted);
}

body[data-theme="dark"] :where(.panel, .table-panel, .task-panel, .submit-panel, .homework-hero, .profile-form, .support-form, .course-hero, .course-admin-row, .student-course-card, .course-progress-rail-card, .lesson-card, .lesson-line, .module-detail-hero, .module-task, .module-summary, .notification-card, .ticket-card, .topic-row, .topic-detail, .category-panel, .doc-card, .docs-module-block, .docs-structure-course, .doc-structure-row, .group-card, .admin-group-card, .teacher-group-card, .teacher-profile-card, .teacher-public-card-preview, .teacher-student-row, .review-row, .call-row, .calls-summary-card, .plot-card, .plot-detail, .plot-edit-line, .uploaded-file, .progress-card, .progress-module-row, .status-panel, .student-status-card, .achievement, .mentor-card, .ask-card, .help-card, .rail-row, .notice-task, .kpi-card, .stats-mini > div, .admin-user-row, .user-row, .user-detail-card, .admin-audit-card, .settings-tariffs-panel, .settings-tariff-row, .admin-tariffs-panel, .admin-tariff-row, .admin-tariff-form-panel, .admin-lesson-row, .admin-lessons-panel, .profile-photo-panel, .profile-security-panel, .profile-stats-grid > div, .teacher-load-card, .quick-links, .quick-actions) {
  background-color: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset, var(--shadow);
}

body[data-theme="dark"] :where(.top-search input, .field input, .field select, .field textarea, .search, .filters input, input, select, textarea) {
  background: #121c17;
  border-color: var(--line);
  color: var(--ink);
}

body[data-theme="dark"] :where(.top-search input, .field input, .field textarea, .search, input, textarea)::placeholder {
  color: #7f8d85;
}

body[data-theme="dark"] .top-search span,
body[data-theme="dark"] .hamburger,
body[data-theme="dark"] .top-icon,
body[data-theme="dark"] .icon-btn,
body[data-theme="dark"] .round-btn {
  color: var(--ink);
}

body[data-theme="dark"] :where(.btn.secondary, .btn.ghost, .link-wide, .profile-chip, .profile-menu button, .notification-popover button, .global-search-popover button) {
  background: #142019;
  color: var(--green-2);
  border-color: var(--line);
}

body[data-theme="dark"] :where(.btn.secondary:hover, .btn.ghost:hover, .profile-chip:hover, .profile-menu button:hover, .search-result-row:hover, .hint-action:hover) {
  background: #1c2b22;
}

body[data-theme="dark"] :where(.profile-menu, .notification-popover, .global-search-popover, .modal-backdrop > *, .course-modal, .group-modal, .user-modal, .lesson-modal, .lesson-editor-modal, .topic-modal, .topic-warning, .plot-create-modal, .plot-file-viewer, .call-modal, .record-link-modal, .call-stats-modal, .student-statuses-modal, .homework-hint-modal, .student-drawer, .review-drawer, .ticket-drawer, .community-profile-drawer, .avatar-crop-modal) {
  background: #17221d;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0,0,0,.44);
}

body[data-theme="dark"] :where(.modal-backdrop, .student-drawer-overlay, .ticket-drawer-overlay, .community-profile-overlay, .avatar-crop-backdrop, .student-statuses-backdrop) {
  background: rgba(4, 8, 7, .66);
}

body[data-theme="dark"] :where(.compact-row, .rail-row, .call-row, .lesson-line, .topic-row, .review-row, .notification-card, .doc-structure-row, .progress-module-row, .admin-user-row, .user-row) {
  border-color: var(--line);
}

body[data-theme="dark"] :where(.badge, .access-badge, .student-level-badge, .status-state, .ticket-status, .notice-chip, .call-stats-chip) {
  background: #223129;
  color: #dfe8e1;
}

body[data-theme="dark"] .badge.green,
body[data-theme="dark"] .access-badge.active,
body[data-theme="dark"] .status-state.done {
  background: rgba(79, 186, 105, .16);
  color: #8be59a;
}

body[data-theme="dark"] .badge.blue { background: rgba(117, 174, 244, .15); color: #9bc8ff; }
body[data-theme="dark"] .badge.amber { background: rgba(242, 180, 87, .16); color: #ffd08a; }
body[data-theme="dark"] .badge.red { background: rgba(255, 118, 118, .14); color: #ff9b9b; }
body[data-theme="dark"] .badge.violet { background: rgba(169, 156, 255, .16); color: #c8bfff; }

body[data-theme="dark"] :where(.progress, .course-progress-block, .module-progress-cell .progress, .course-progress-rail-list div, .calls-summary-row, .hint-modal-steps div, .record-storage-note) {
  background: #101a15;
  border-color: var(--line);
}

body[data-theme="dark"] :where(.ring, .lesson-ring) {
  filter: saturate(.92) brightness(.96);
}

body[data-theme="dark"] .watermark {
  color: rgba(233, 240, 234, .24);
}

body[data-theme="dark"] .toast {
  background: #0c1410;
  color: var(--ink);
  border: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .topbar.has-page-title {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto !important;
  }
}

@media (max-width: 760px) {
  .topbar,
  .topbar.has-page-title {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  }
  .theme-toggle {
    min-width: 42px;
    width: 42px;
    grid-template-columns: 1fr;
  }
  .theme-toggle span:not(.active) {
    display: none;
  }
}

/* Step 69: community actions, favorites, pinned topics */
.pin-row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  border-radius: 9px;
  align-items: start;
}
.pin-row:hover {
  background: var(--soft-green);
  color: var(--green);
  padding-left: 8px;
  padding-right: 8px;
}
.pin-row.topic-pin-link span:last-child {
  font-weight: 800;
  line-height: 1.25;
}
.pinned-divider {
  margin: 12px 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.topic-row.pinned {
  background: linear-gradient(90deg, rgba(31,122,63,.08), transparent);
  border-radius: 10px;
  padding-left: 10px;
  padding-right: 10px;
  margin-left: -10px;
  margin-right: -10px;
}
.topic-row-tools {
  display: grid;
  grid-template-columns: auto auto;
  gap: 7px;
  align-items: center;
  justify-items: stretch;
  min-width: 150px;
}
.topic-row-tools .btn {
  grid-column: 1 / -1;
  width: 100%;
}
.topic-mini-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.topic-mini-btn.active {
  background: var(--soft-green);
  border-color: rgba(31,122,63,.22);
}

.topic-delete-btn {
  color: #b42318;
}

.topic-delete-btn:hover {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}
.topic-detail-actions {
  margin: 12px 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}
.community-info-modal {
  width: min(720px, 94vw);
}

.community-members-backdrop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.community-members-modal {
  width: min(860px, 94vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.community-members-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.community-members-head-text h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.25;
}

.community-members-head-text .muted {
  margin: 0;
  font-size: 14px;
}

.community-members-stats-line {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.community-members-controls {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  display: grid;
  gap: 12px;
}

.community-members-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}

.community-members-filters {
  margin-bottom: 0;
}

.community-info-list,
.community-members-list {
  margin: 0;
}

.community-members-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.community-member-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.community-member-card:hover {
  border-color: var(--accent-border);
  background: var(--soft-green);
}

.community-member-card-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.community-member-avatar {
  width: 48px;
  height: 48px;
}

.community-member-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.community-member-name {
  font-size: 15px;
  line-height: 1.3;
}

.community-member-nickname {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}

.community-profile-nickname {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
}

.community-mention {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.community-mention:hover,
.community-mention:focus-visible {
  text-decoration: underline;
}

.community-member-card-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.community-member-meta-item b {
  color: var(--ink);
  font-weight: 600;
}

.community-member-email {
  font-size: 11px;
  opacity: 0.82;
}

.community-member-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.community-member-card-actions:has(.community-member-profile-btn:only-child) {
  grid-template-columns: 1fr;
}

.community-member-write-btn,
.community-member-profile-btn {
  width: 100%;
  font-size: 13px;
}

.community-members-empty {
  grid-column: 1 / -1;
  padding: 36px 16px;
  text-align: center;
}

.community-members-empty strong {
  display: block;
  margin-bottom: 6px;
}

.community-members-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
}
.community-info-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfb;
}
.community-info-step b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}
.community-info-step span {
  line-height: 1.45;
}

@media (max-width: 720px) {
  .community-members-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .community-members-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
  }

  .community-members-list {
    grid-template-columns: 1fr;
  }
}
body[data-role="student"] .community-layout .ask-card .ask-card-actions,
body[data-role="mentor"] .community-layout .ask-card .ask-card-actions,
body[data-role="admin"] .community-layout .ask-card .ask-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
body[data-role="student"] .community-layout .ask-card .ask-card-actions .btn,
body[data-role="mentor"] .community-layout .ask-card .ask-card-actions .btn,
body[data-role="admin"] .community-layout .ask-card .ask-card-actions .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  justify-content: center;
  text-align: center;
}
body[data-theme="dark"] .topic-mini-btn,
body[data-theme="dark"] .community-member-card,
body[data-theme="dark"] .community-info-step,
body[data-theme="dark"] .topic-detail-actions {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.12);
}
@media (max-width: 980px) {
  .topic-row-tools {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}

/* Step 70: cleaner community pinned guide modals */
.community-info-modal {
  width: min(760px, 94vw);
  padding: 20px 22px 22px;
}
.community-info-head {
  align-items: start;
  margin-bottom: 8px;
}
.community-info-head h2 {
  margin-bottom: 6px;
}
.community-info-list {
  gap: 12px;
  margin: 18px 0 16px;
}
.community-info-step {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(31,122,63,.045), rgba(31,122,63,.015));
}
.community-info-step b {
  width: 28px;
  height: 28px;
  font-size: 14px;
}
.community-info-step div {
  display: grid;
  gap: 4px;
}
.community-info-step strong {
  color: var(--text);
  line-height: 1.25;
}
.community-info-step span {
  color: var(--muted);
  line-height: 1.45;
}
.community-info-actions {
  margin-top: 6px;
  justify-content: flex-start;
}
.community-info-actions .btn {
  min-width: 160px;
}
body[data-theme="dark"] .community-info-step {
  background: rgba(255,255,255,.045);
}


/* Step 71: stable sidebar navigation focus */
.menu button:focus {
  outline: none;
}
.menu button:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 0 0 2px rgba(255,255,255,.18);
}

/* Step 74: student courses program opening and course about modal */
.student-program-title {
  margin-top: 20px;
  margin-bottom: 12px;
  align-items: end;
}
.student-program-title .block-title {
  margin: 0;
}
.student-course-card {
  cursor: pointer;
}
.student-course-card .btn,
.student-course-card button {
  cursor: pointer;
}
.student-course-card.selected-course-card {
  border-color: rgba(46, 139, 66, .28);
  box-shadow: 0 0 0 1px rgba(46, 139, 66, .08);
}
.student-course-card.course-locked {
  opacity: .92;
}
.student-course-card.course-locked img {
  filter: grayscale(.35);
}
.course-progress-locked {
  padding: 10px 0 4px;
  color: var(--muted);
}
.course-access-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.module-access-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, .06);
}
.program-module.locked,
.lesson-module.locked {
  opacity: .88;
}
.program-module.locked .module-summary,
.lesson-module.locked .lesson-module-head {
  background: rgba(0, 0, 0, .02);
}
.module-access-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 120px;
}
.student-course-card.course-partial {
  border-color: rgba(46, 139, 66, .16);
}
.course-about-modal {
  max-width: 760px;
}
.course-promo-page {
  display: grid;
  gap: 16px;
}
.course-promo-top {
  display: flex;
  justify-content: flex-start;
}
.course-promo-hero {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 24px;
  align-items: start;
}
.course-promo-hero > img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 16px;
}
.course-promo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.course-promo-head h1 {
  margin: 0;
  font-size: 1.6rem;
}
.course-promo-lead {
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.6;
}
.course-promo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.course-promo-stats span {
  display: block;
  color: var(--muted);
  font-size: .85rem;
}
.course-promo-stats b {
  display: block;
  margin-top: 4px;
  color: var(--text);
}
.course-promo-block h2 {
  margin: 0 0 12px;
}
.course-promo-program-list,
.course-promo-bullets {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 8px;
}
.course-promo-note {
  margin-top: 14px;
}
.course-promo-admin-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, .08);
}
.course-promo-admin-block h3 {
  margin: 0 0 8px;
}
.student-course-card.course-catalog-locked {
  border-style: dashed;
}
.student-course-card.course-catalog-locked .course-progress-locked small:last-child {
  display: block;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .course-promo-hero {
    grid-template-columns: 1fr;
  }
}
.course-about-text {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.course-about-stats {
  margin: 14px 0 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.course-about-modal .course-about-stat-card {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 14px 12px;
  border: 1px solid rgba(23, 27, 34, .12);
  border-radius: 8px;
  background: #f4f7f5;
}
.course-about-modal .course-about-stat-card b {
  display: block;
  color: #171b22;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}
.course-about-modal .course-about-stat-card small {
  color: #56605a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
body[data-theme="dark"] .course-about-modal .course-about-stat-card {
  background: #f4f7f5;
  border-color: rgba(23, 27, 34, .12);
}
body[data-theme="dark"] .course-about-modal .course-about-stat-card b {
  color: #171b22;
}
body[data-theme="dark"] .course-about-modal .course-about-stat-card small {
  color: #56605a;
}
.course-about-modules h3 {
  margin: 0 0 10px;
}
.course-about-modules .compact-row {
  align-items: start;
}
.course-about-modules .compact-row span {
  margin-top: 4px;
  line-height: 1.35;
}
body[data-theme="dark"] .program-module.expanded {
  background: linear-gradient(90deg, rgba(65, 170, 90, .14), var(--panel) 32%);
}

/* Step 76: course-specific progress system */
.progress span {
  background: var(--progress-color, linear-gradient(90deg, #2f8a42, #246f36));
}
.ring {
  background:
    radial-gradient(circle closest-side, #fff 70%, transparent 71%),
    conic-gradient(var(--ring-color, var(--green)) calc(var(--p) * 1%), #e7ebe7 0);
}
.progress-status-label {
  display: block;
  margin: -8px 0 12px;
  color: var(--ink);
  font-weight: 900;
}
.course-progress-rail-course {
  margin: -4px 0 6px;
  font-weight: 700;
  line-height: 1.25;
}
.course-progress-state {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-weight: 800;
}
.progress-course-tabs {
  margin: 0 0 14px;
}
.progress-course-tabs button {
  min-height: 42px;
}
.progress-course-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(36, 111, 54, .1);
  color: var(--green);
  font-weight: 900;
}
.progress-module-row > span,
.progress-module-row > div,
.progress-module-row > button {
  min-width: 0;
}
.progress-module-row .module-progress-cell {
  min-width: 120px;
}
body[data-theme="dark"] .ring {
  background:
    radial-gradient(circle closest-side, var(--panel) 70%, transparent 71%),
    conic-gradient(var(--ring-color, var(--green)) calc(var(--p) * 1%), rgba(255,255,255,.12) 0);
}
body[data-theme="dark"] .progress-course-tabs span {
  background: rgba(87, 161, 106, .16);
  color: #a7e3b4;
}

/* Step 77: clean course progress card and module rows */
body[data-role="student"][data-active="progress"] .progress-course-card-clean {
  display: grid;
  gap: 14px;
}
body[data-role="student"][data-active="progress"] .progress-course-card-clean .progress-card-head {
  margin-bottom: 0;
}
body[data-role="student"][data-active="progress"] .progress-course-name {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbf8;
}
body[data-role="student"][data-active="progress"] .progress-course-name span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
body[data-role="student"][data-active="progress"] .progress-course-name strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}
body[data-role="student"][data-active="progress"] .progress-card-overview {
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
body[data-role="student"][data-active="progress"] .progress-card-overview .ring {
  --size: 108px;
  margin: 0 auto;
}
body[data-role="student"][data-active="progress"] .progress-card-overview .ring strong,
body[data-role="student"][data-active="progress"] .progress-sidebar .ring strong,
body[data-role="student"][data-active="progress"] .course-progress-rail-card .ring strong {
  top: 47%;
  font-size: 28px;
  line-height: 1;
}
body[data-role="student"][data-active="progress"] .progress-card-overview .ring span,
body[data-role="student"][data-active="progress"] .progress-sidebar .ring span,
body[data-role="student"][data-active="progress"] .course-progress-rail-card .ring span {
  top: 64%;
  width: 68%;
  font-size: 9.5px;
  line-height: 1.05;
  font-weight: 850;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean {
  gap: 8px;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean > strong {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff7e8;
  color: #be6a10;
  font-size: 13px;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7fbf8;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}
body[data-role="student"][data-active="progress"] .progress-module-row.progress-module-row-clean {
  grid-template-columns: 86px minmax(220px, 1fr) 132px minmax(260px, .9fr) 124px;
  gap: 12px;
  align-items: center;
}
body[data-role="student"][data-active="progress"] .progress-module-row-clean .module-title {
  min-width: 0;
}
body[data-role="student"][data-active="progress"] .progress-module-row-clean .module-title strong {
  display: block;
  line-height: 1.25;
}
body[data-role="student"][data-active="progress"] .progress-module-row-clean .module-title small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.25;
}
body[data-role="student"][data-active="progress"] .module-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
body[data-role="student"][data-active="progress"] .module-meta-grid > span {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: #f7fbf8;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
body[data-role="student"][data-active="progress"] .module-meta-grid b {
  color: var(--ink);
  font-size: 13px;
}
body[data-role="student"][data-active="progress"] .progress-module-row-clean > .btn {
  align-self: center;
  justify-self: end;
  width: 100%;
  max-width: 124px;
  min-height: 44px;
}
@media (max-width: 1480px) {
  body[data-role="student"][data-active="progress"] .progress-module-row.progress-module-row-clean {
    grid-template-columns: 78px minmax(180px, 1fr) 120px minmax(210px, .9fr) 112px;
    gap: 10px;
  }
}
@media (max-width: 1180px) {
  body[data-role="student"][data-active="progress"] .progress-card-overview,
  body[data-role="student"][data-active="progress"] .progress-module-row.progress-module-row-clean {
    grid-template-columns: 1fr;
  }
  body[data-role="student"][data-active="progress"] .progress-module-row-clean > .btn {
    justify-self: stretch;
    max-width: none;
  }
}
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-name,
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-summary-clean p,
body[data-theme="dark"][data-role="student"][data-active="progress"] .module-meta-grid > span {
  background: rgba(255,255,255,.045);
  border-color: rgba(255,255,255,.08);
}
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-summary-clean > strong {
  background: rgba(225, 144, 47, .16);
  color: #f6c37c;
}


body[data-theme="dark"] .group-detail-grid section.group-card {
  box-shadow: 0 16px 30px rgba(0, 0, 0, .2);
  border-color: rgba(255, 255, 255, .08);
}

body[data-theme="dark"] .group-detail-grid section.group-card::before {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 72%, #0d1511) 0%,
    color-mix(in srgb, var(--accent) 46%, #101713) 100%
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .1) inset,
    0 0 12px color-mix(in srgb, var(--accent) 18%, transparent);
  opacity: .92;
}

body[data-theme="dark"] .group-detail-grid section.group-card > h3 {
  border-bottom-color: rgba(255, 255, 255, .08);
}

body[data-theme="dark"] .group-detail-grid .group-card .compact-row,
body[data-theme="dark"] .group-detail-grid .group-card .compact-row.action-row {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .08);
}

body[data-theme="dark"] .group-detail-grid .group-card .compact-row.action-row:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .14);
}

body[data-theme="dark"] .group-detail-grid .group-card .empty-inline {
  background: rgba(255, 255, 255, .03);
  border-color: rgba(255, 255, 255, .12);
}

body[data-theme="dark"] .students-card {
  background: linear-gradient(180deg, rgba(34, 44, 41, .98) 0%, rgba(24, 30, 28, .98) 100%);
  border-color: rgba(199, 214, 204, .15);
}

body[data-theme="dark"] .homework-card {
  background: linear-gradient(180deg, rgba(59, 45, 20, .72) 0%, rgba(27, 30, 29, .98) 100%);
  border-color: rgba(243, 163, 34, .2);
}

body[data-theme="dark"] .tickets-card {
  background: linear-gradient(180deg, rgba(23, 43, 52, .82) 0%, rgba(24, 30, 28, .98) 100%);
  border-color: rgba(116, 188, 230, .2);
}

body[data-theme="dark"] .community-card {
  background: linear-gradient(180deg, rgba(27, 48, 31, .8) 0%, rgba(24, 30, 28, .98) 100%);
  border-color: rgba(68, 168, 93, .2);
}

body[data-theme="dark"] .calls-card {
  background: linear-gradient(180deg, rgba(20, 43, 38, .82) 0%, rgba(24, 30, 28, .98) 100%);
  border-color: rgba(84, 179, 152, .2);
}

body[data-theme="dark"] .history-card {
  background: linear-gradient(180deg, rgba(52, 45, 33, .8) 0%, rgba(24, 30, 28, .98) 100%);
  border-color: rgba(207, 188, 154, .2);
}

/* Step 82: keep curved label only for course progress rings */
.ring.ring-course-arc strong {
  top: 50%;
  z-index: 2;
}

.ring.ring-course-arc .ring-curve {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 1;
  pointer-events: none;
}

.ring.ring-course-arc .ring-curve text {
  fill: var(--muted);
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: .02em;
}

body[data-role="student"][data-active="courses"] .course-progress-rail-card .ring.ring-course-arc strong,
body[data-role="student"][data-active="progress"] .progress-card-overview .ring.ring-course-arc strong,
body[data-role="student"][data-active="progress"] .progress-sidebar .ring.ring-course-arc strong,
body[data-role="student"][data-active="progress"] .course-progress-rail-card .ring.ring-course-arc strong {
  top: 50%;
}

body[data-role="student"][data-active="courses"] .course-progress-rail-card .ring.ring-course-arc .ring-curve text,
body[data-role="student"][data-active="progress"] .progress-card-overview .ring.ring-course-arc .ring-curve text,
body[data-role="student"][data-active="progress"] .progress-sidebar .ring.ring-course-arc .ring-curve text,
body[data-role="student"][data-active="progress"] .course-progress-rail-card .ring.ring-course-arc .ring-curve text {
  font-size: 9px;
}


body[data-theme="dark"] .homework-hint-modal .modal-x {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  color: var(--ink);
}
body[data-theme="dark"] .homework-hint-modal .modal-x:hover {
  background: rgba(255, 255, 255, .1);
  color: #a7e3b4;
}
body[data-theme="dark"] .hint-modal-text {
  background: rgba(87, 161, 106, .1);
  border-color: rgba(87, 161, 106, .18);
}

/* Step 84: homework submission sync between student, teacher and admin */
.student-homework-files {
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf8;
}
.student-homework-files h3,
.student-work-files h3,
.review-history h3,
.student-work-summary h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.homework-upload-empty {
  margin: 12px 0 14px;
}
.student-work-summary {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid rgba(36, 115, 56, .14);
  border-radius: 12px;
  background: #f7fbf8;
}
.student-work-summary p {
  margin: 0;
  line-height: 1.5;
}
.student-work-files,
.review-history {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.admin-review-note {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(46, 120, 214, .18);
  border-radius: 12px;
  background: #f5fbff;
}
.admin-review-note strong {
  color: var(--blue);
}
.admin-review-note span {
  color: var(--muted);
  line-height: 1.4;
}
body[data-theme="dark"] .student-homework-files,
body[data-theme="dark"] .student-work-summary,
body[data-theme="dark"] .student-work-files,
body[data-theme="dark"] .review-history {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
}
body[data-theme="dark"] .admin-review-note {
  background: rgba(46, 120, 214, .1);
  border-color: rgba(46, 120, 214, .24);
}

/* Step 89: admin home command center links */
.admin-command-center .admin-task-row,
.admin-command-center .admin-state-row,
.admin-dashboard-modal .admin-task-row,
.admin-dashboard-modal .admin-state-row {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.admin-command-center .admin-task-row:hover,
.admin-command-center .admin-state-row:hover,
.admin-dashboard-modal .admin-task-row:hover,
.admin-dashboard-modal .admin-state-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(19, 42, 26, .08);
  background: #f6fbf7;
  border-color: rgba(36, 115, 56, .18);
}

.admin-dashboard-modal {
  max-width: 760px;
}

.admin-dashboard-modal .admin-modal-list {
  display: grid;
  gap: 10px;
  margin: 10px 0 18px;
}

.admin-platform-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

body[data-theme="dark"] .admin-command-center .admin-task-row:hover,
body[data-theme="dark"] .admin-command-center .admin-state-row:hover,
body[data-theme="dark"] .admin-dashboard-modal .admin-task-row:hover,
body[data-theme="dark"] .admin-dashboard-modal .admin-state-row:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .14);
  box-shadow: 0 14px 26px rgba(0, 0, 0, .22);
}

@media (max-width: 760px) {
  .admin-platform-summary {
    grid-template-columns: 1fr;
  }
}

/* Step 90: admin courses lifecycle and lessons structure */
body[data-role="admin"][data-active="courses"] .course-admin-row-expanded {
  grid-template-columns: minmax(240px, 1.2fr) 96px 130px minmax(420px, 1.6fr);
  gap: 14px;
  align-items: center;
}

body[data-role="admin"][data-active="courses"] .course-admin-main,
body[data-role="admin"][data-active="courses"] .course-admin-main strong,
body[data-role="admin"][data-active="courses"] .course-admin-main small {
  display: block;
  min-width: 0;
}

body[data-role="admin"][data-active="courses"] .course-admin-main small {
  margin-top: 5px;
  color: var(--muted);
}

body[data-role="admin"][data-active="courses"] .course-admin-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  justify-content: stretch;
}

body[data-role="admin"][data-active="courses"] .course-admin-actions .btn {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  white-space: normal;
  line-height: 1.15;
}

body[data-role="admin"][data-active="lessons"] .admin-lessons-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

body[data-role="admin"][data-active="lessons"] .admin-lessons-main,
body[data-role="admin"][data-active="lessons"] .admin-lessons-panel {
  min-width: 0;
  overflow: hidden;
}

body[data-role="admin"][data-active="lessons"] .admin-lessons-rail,
body[data-role="admin"][data-active="lessons"] .right-rail.admin-lessons-rail {
  position: static;
  width: 320px;
  max-width: 320px;
  min-width: 0;
  z-index: 1;
  align-self: start;
}

body[data-role="admin"][data-active="lessons"] .lesson-admin-filters {
  grid-template-columns: minmax(160px, 1fr) minmax(210px, 1.25fr) minmax(130px, .75fr) minmax(130px, .75fr) minmax(180px, 1fr);
}

.admin-lesson-structure {
  display: grid;
  gap: 16px;
}

.admin-course-lessons-block {
  border: 1px solid rgba(36, 115, 56, .12);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.admin-course-lessons-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(36, 115, 56, .08), rgba(36, 115, 56, .02));
  border-bottom: 1px solid rgba(36, 115, 56, .1);
}

.admin-course-lessons-head strong,
.admin-course-lessons-head span {
  display: block;
}

.admin-course-lessons-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.admin-lesson-module-block {
  padding: 0;
  border-top: 1px solid var(--line);
}

.admin-lesson-module-block:first-of-type {
  border-top: 0;
}

.admin-lesson-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fbfdfb;
}

.admin-lesson-module-head b,
.admin-lesson-module-head span {
  display: block;
}

.admin-lesson-module-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.admin-lesson-module-head em {
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-list.compact {
  display: grid;
  gap: 0;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .72fr) minmax(228px, .88fr);
  gap: 12px 14px;
  padding: 12px 16px;
  min-width: 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-side {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  justify-items: stretch;
  overflow: visible;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row:first-child {
  border-top: 0;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-title strong {
  font-size: 15px;
  line-height: 1.18;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-title small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  line-height: 1.25;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row .lesson-bits {
  grid-column: auto;
  grid-template-columns: repeat(3, max-content);
  gap: 8px 12px;
  flex-wrap: wrap;
}

body[data-role="admin"][data-active="lessons"] .lesson-bit-video.missing {
  color: #b45309;
}

body[data-role="admin"][data-active="lessons"] .lesson-bit-video.ok {
  color: var(--green);
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-meta {
  display: grid;
  gap: 5px;
  min-width: 0;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-meta small {
  overflow-wrap: anywhere;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-date {
  justify-self: start;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row .row-actions,
body[data-role="admin"][data-active="lessons"] .admin-lesson-row .admin-lesson-actions {
  grid-column: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row .row-actions .btn,
body[data-role="admin"][data-active="lessons"] .admin-lesson-row .admin-lesson-actions .btn {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
  white-space: normal;
  line-height: 1.15;
  text-align: center;
  justify-content: center;
}

body[data-role="admin"][data-active="lessons"] .admin-lesson-row:hover,
body[data-role="admin"][data-active="lessons"] .admin-lesson-row.selected {
  background: linear-gradient(90deg, rgba(36, 115, 56, .09), rgba(255,255,255,.4));
}

body[data-theme="dark"] .admin-course-lessons-block {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.08);
}

body[data-theme="dark"] .admin-course-lessons-head,
body[data-theme="dark"] .admin-lesson-module-head {
  background: rgba(255,255,255,.045);
  border-color: rgba(255,255,255,.08);
}

body[data-theme="dark"][data-role="admin"][data-active="lessons"] .admin-lesson-row:hover,
body[data-theme="dark"][data-role="admin"][data-active="lessons"] .admin-lesson-row.selected {
  background: rgba(255,255,255,.06);
}

@media (max-width: 1450px) {
  body[data-role="admin"][data-active="lessons"] .admin-lessons-layout {
    grid-template-columns: 1fr;
  }
  body[data-role="admin"][data-active="lessons"] .admin-lessons-rail,
  body[data-role="admin"][data-active="lessons"] .right-rail.admin-lessons-rail {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 980px) {
  body[data-role="admin"][data-active="courses"] .course-admin-row-expanded,
  body[data-role="admin"][data-active="lessons"] .lesson-admin-filters,
  body[data-role="admin"][data-active="lessons"] .admin-lesson-row {
    grid-template-columns: 1fr;
  }
  body[data-role="admin"][data-active="courses"] .course-admin-actions,
  body[data-role="admin"][data-active="lessons"] .admin-lesson-row .row-actions,
  body[data-role="admin"][data-active="lessons"] .admin-lesson-row .admin-lesson-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Step 91: fix profile notification rows readability in dark theme */
body[data-theme="dark"] .toggle-row {
  background: rgba(255, 255, 255, .045);
  border-color: rgba(228, 238, 230, .16);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}

body[data-theme="dark"] .toggle-row strong {
  color: var(--ink);
}

body[data-theme="dark"] .toggle-row small {
  color: #b9c7bf;
}

body[data-theme="dark"] .toggle-row:hover {
  background: rgba(255, 255, 255, .075);
  border-color: rgba(88, 185, 108, .35);
}

body[data-theme="dark"] .toggle-row input {
  accent-color: var(--green);
}


/* Step 92: dark theme readability sweep — dark-only, no light theme changes */
body[data-theme="dark"] {
  --dark-card: rgba(255, 255, 255, .045);
  --dark-card-strong: rgba(255, 255, 255, .07);
  --dark-card-hover: rgba(255, 255, 255, .085);
  --dark-border: rgba(228, 238, 230, .15);
  --dark-text: #edf5ef;
  --dark-muted: #b7c5bc;
}

/* Reset light gradients/white cards that stayed on top of dark mode */
body[data-theme="dark"] :where(
  .notification-card,
  .ticket-card,
  .topic-row,
  .topic-row.pinned,
  .user-detail-grid > span,
  .group-meta > span,
  .group-summary > span,
  .teacher-group-metrics > span,
  .activity-stats > span,
  .next-action-row,
  .achievement,
  .mentor-facts > span,
  .ticket-summary > span,
  .support-queue-grid button,
  .message-bubble,
  .notification-metrics button,
  .student-checks label,
  .group-teacher-strip,
  .plot-mentor-note,
  .field-line.teacher p,
  .screens button,
  .doc-chips span,
  .doc-chips button,
  .doc-relation,
  .doc-tags > span:not(.badge),
  .docs-module-block,
  .doc-structure-row,
  .progress-module-row,
  .next-status span,
  .plot-status-list span,
  .course-progress-rail-list div,
  .status-progress-summary span,
  .student-status-card,
  .status-check,
  .hint-action,
  .search-result-row,
  .plot-file-image-preview,
  .plot-doc-preview,
  .call-stats-modal-grid span,
  .call-stats-chip,
  .call-stats-result-row,
  .record-storage-note,
  .profile-photo-actions.compact-photo-actions,
  .admin-user-drawer-top,
  .settings-tariff-row,
  .admin-tariff-row,
  .calls-summary-row,
  .homework-submission,
  .review-comment,
  .review-student-comment,
  .student-comment,
  .submission-comment,
  .uploaded-file
) {
  background: var(--dark-card) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset;
}

body[data-theme="dark"] :where(
  .notification-card:hover,
  .topic-row:hover,
  .support-queue-grid button:hover,
  .search-result-row:hover,
  .call-stats-chip:hover,
  .hint-action:hover,
  .next-action-row:hover
) {
  background: var(--dark-card-hover) !important;
  border-color: rgba(88, 185, 108, .34) !important;
}

body[data-theme="dark"] .ticket-card:hover {
  transform: translateY(-2px);
  background: var(--dark-card-hover) !important;
  border-color: rgba(88, 185, 108, .34) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

body[data-theme="dark"] .ticket-card:hover .btn.secondary {
  border-color: rgba(88, 185, 108, 0.42) !important;
  background: rgba(58, 152, 76, 0.14) !important;
  color: #b8efc3 !important;
}

body[data-theme="dark"] .ticket-card:focus-within {
  border-color: rgba(88, 185, 108, 0.48) !important;
  box-shadow: 0 0 0 3px rgba(88, 185, 108, 0.16) !important;
}

body[data-theme="dark"] .notification-card.unread,
body[data-theme="dark"] .notification-card.important,
body[data-theme="dark"] .topic-row.pinned,
body[data-theme="dark"] .student-status-card.current,
body[data-theme="dark"] .group-card.active,
body[data-theme="dark"] .teacher-group-card.active {
  background: linear-gradient(90deg, rgba(58, 152, 76, .13), rgba(255, 255, 255, .045) 62%) !important;
  border-color: rgba(88, 185, 108, .26) !important;
}

body[data-theme="dark"] :where(
  .notification-card h3,
  .notification-card strong,
  .notification-card b,
  .ticket-card h3,
  .ticket-card strong,
  .ticket-card b,
  .topic-row h3,
  .topic-row strong,
  .topic-row b,
  .user-detail-grid b,
  .group-meta b,
  .group-summary b,
  .teacher-group-metrics b,
  .activity-stats b,
  .field-line b,
  .doc-relation b,
  .support-queue-grid strong,
  .notification-metrics b,
  .student-status-card strong,
  .admin-audit-item p,
  .message-bubble strong
) {
  color: var(--dark-text) !important;
}

body[data-theme="dark"] :where(
  .notification-card p,
  .notification-card span:not(.badge):not(.notice-chip),
  .notification-card small,
  .ticket-card p,
  .ticket-card span:not(.badge):not(.ticket-status),
  .ticket-card small,
  .topic-row p,
  .topic-row span:not(.badge):not(.topic-status),
  .topic-row small,
  .user-detail-grid span,
  .group-meta span,
  .group-summary span,
  .teacher-group-metrics span,
  .activity-stats span,
  .field-line span,
  .field-line p,
  .doc-relation,
  .doc-relation span,
  .support-queue-grid button,
  .message-bubble,
  .message-bubble p,
  .message-bubble small,
  .notification-metrics button,
  .notification-metrics span,
  .student-status-card p,
  .student-status-card small,
  .admin-audit-item p,
  .admin-audit-item small
) {
  color: var(--dark-muted) !important;
}

/* Dark notification icons keep category colors without white tiles */
body[data-theme="dark"] .notice-icon {
  background: rgba(255, 255, 255, .08) !important;
  border: 1px solid rgba(255, 255, 255, .1);
}
body[data-theme="dark"] .notice-icon.homework { color: #93c5fd !important; }
body[data-theme="dark"] .notice-icon.plots { color: #86efac !important; }
body[data-theme="dark"] .notice-icon.calls { color: #facc15 !important; }
body[data-theme="dark"] .notice-icon.community { color: #c4b5fd !important; }
body[data-theme="dark"] .notice-icon.docs { color: #d7e1db !important; }
body[data-theme="dark"] .notice-icon.support { color: #fbbf24 !important; }

/* Admin/teacher/student profile toggles — final dark readable version */
body[data-theme="dark"] .toggle-row {
  background: var(--dark-card) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}
body[data-theme="dark"] .toggle-row strong {
  color: var(--dark-text) !important;
}
body[data-theme="dark"] .toggle-row small {
  color: var(--dark-muted) !important;
}
body[data-theme="dark"] .toggle-row:hover {
  background: var(--dark-card-hover) !important;
}

/* Group pages: keep the tile layout but make every card readable */
body[data-theme="dark"] .group-detail-grid section,
body[data-theme="dark"] .group-detail-grid section.group-card,
body[data-theme="dark"] .students-card,
body[data-theme="dark"] .homework-card,
body[data-theme="dark"] .tickets-card,
body[data-theme="dark"] .community-card,
body[data-theme="dark"] .calls-card,
body[data-theme="dark"] .history-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .032)) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}
body[data-theme="dark"] .group-detail-grid .group-card .compact-row,
body[data-theme="dark"] .group-detail-grid .group-card .compact-row.action-row,
body[data-theme="dark"] .compact-row,
body[data-theme="dark"] .rail-row {
  border-color: rgba(255, 255, 255, .11) !important;
  color: var(--dark-muted) !important;
}
body[data-theme="dark"] .compact-row strong,
body[data-theme="dark"] .compact-row b,
body[data-theme="dark"] .rail-row strong,
body[data-theme="dark"] .rail-row b {
  color: var(--dark-text) !important;
}

/* Plot detail and document cards: inner chips/fields no longer stay white */
body[data-theme="dark"] .plot-bottom {
  border-color: var(--dark-border) !important;
}
body[data-theme="dark"] .plot-bottom > div {
  border-color: var(--dark-border) !important;
}
body[data-theme="dark"] .doc-icon {
  background: rgba(88, 185, 108, .13) !important;
  color: #8be59a !important;
}
body[data-theme="dark"] .doc-tags > span:not(.badge),
body[data-theme="dark"] .doc-chips span,
body[data-theme="dark"] .doc-chips button {
  color: var(--dark-muted) !important;
}

/* Support/queue small statistic tiles */
body[data-theme="dark"] .support-queue-grid button b,
body[data-theme="dark"] .support-queue-grid button strong,
body[data-theme="dark"] .notification-metrics button b,
body[data-theme="dark"] .notification-metrics button strong {
  color: var(--dark-text) !important;
}

/* White secondary buttons are intentionally kept readable; only inactive disabled buttons are toned down */
body[data-theme="dark"] .btn:disabled,
body[data-theme="dark"] button:disabled {
  opacity: .58;
}

/* Step 93: dark theme readability polish — dark-only, light theme untouched */
body[data-theme="dark"] {
  --dark-card-readable: rgba(255, 255, 255, .052);
  --dark-card-readable-strong: rgba(255, 255, 255, .075);
  --dark-card-readable-hover: rgba(255, 255, 255, .095);
  --dark-readable-border: rgba(228, 238, 230, .17);
  --dark-readable-text: #edf5ef;
  --dark-readable-muted: #bdcbc2;
}

/* Secondary/ghost buttons stayed white in several dark pages because of stronger base selectors. */
body[data-theme="dark"] .btn.secondary,
body[data-theme="dark"] button.btn.secondary,
body[data-theme="dark"] .btn.ghost,
body[data-theme="dark"] button.btn.ghost,
body[data-theme="dark"] .link-wide {
  background: rgba(255, 255, 255, .06) !important;
  border-color: var(--dark-readable-border) !important;
  color: #8ee09d !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset !important;
}
body[data-theme="dark"] .btn.secondary:hover,
body[data-theme="dark"] button.btn.secondary:hover,
body[data-theme="dark"] .btn.ghost:hover,
body[data-theme="dark"] button.btn.ghost:hover,
body[data-theme="dark"] .link-wide:hover {
  background: rgba(88, 185, 108, .14) !important;
  border-color: rgba(88, 185, 108, .34) !important;
  color: #a9efb4 !important;
}
body[data-theme="dark"] .btn.secondary:disabled,
body[data-theme="dark"] button.btn.secondary:disabled,
body[data-theme="dark"] .btn.ghost:disabled,
body[data-theme="dark"] button.btn.ghost:disabled {
  opacity: 1 !important;
  background: rgba(255, 255, 255, .04) !important;
  border-color: rgba(228, 238, 230, .11) !important;
  color: rgba(189, 203, 194, .66) !important;
  cursor: not-allowed;
}

/* White inner cards/rows that were unreadable in dark mode. */
body[data-theme="dark"] .login-card,
body[data-theme="dark"] .program-module,
body[data-theme="dark"] .program-module.expanded,
body[data-theme="dark"] .module-lessons,
body[data-theme="dark"] .module-summary,
body[data-theme="dark"] .lesson-module-head,
body[data-theme="dark"] .lesson-line.task,
body[data-theme="dark"] .lesson-line.current,
body[data-theme="dark"] .responsibility-item,
body[data-theme="dark"] .vk-connected,
body[data-theme="dark"] .vk-connect-flow,
body[data-theme="dark"] .vk-settings label,
body[data-theme="dark"] .student-checks label,
body[data-theme="dark"] .stats-mini span,
body[data-theme="dark"] .profile-stats-grid span,
body[data-theme="dark"] .course-meta span,
body[data-theme="dark"] .group-meta span,
body[data-theme="dark"] .group-summary span,
body[data-theme="dark"] .teacher-group-metrics span,
body[data-theme="dark"] .activity-stats span,
body[data-theme="dark"] .ticket-summary > span,
body[data-theme="dark"] .mentor-facts > span,
body[data-theme="dark"] .status-progress-summary span,
body[data-theme="dark"] .next-status span,
body[data-theme="dark"] .plot-status-list span,
body[data-theme="dark"] .student-program-list .round-btn,
body[data-theme="dark"] .topic-answer,
body[data-theme="dark"] .checkbox-stack,
body[data-theme="dark"] .pager,
body[data-theme="dark"] .pager button,
body[data-theme="dark"] .drawer-close,
body[data-theme="dark"] .danger-outline,
body[data-theme="dark"] .danger-ghost,
body[data-theme="dark"] .mini-notice-list button.read {
  background: var(--dark-card-readable) !important;
  border-color: var(--dark-readable-border) !important;
  color: var(--dark-readable-text) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset !important;
}
body[data-theme="dark"] .program-module.expanded,
body[data-theme="dark"] .lesson-line.current,
body[data-theme="dark"] .group-card.active,
body[data-theme="dark"] .student-course-card.selected-course-card {
  background: linear-gradient(90deg, rgba(88, 185, 108, .13), rgba(255, 255, 255, .045) 58%) !important;
  border-color: rgba(88, 185, 108, .3) !important;
}
body[data-theme="dark"] .module-lessons {
  background: rgba(255, 255, 255, .025) !important;
  border-top-color: var(--dark-readable-border) !important;
}
body[data-theme="dark"] .lesson-line {
  border-bottom-color: rgba(228, 238, 230, .13) !important;
}

/* Text inside those cards. Badges/chips keep their own colors. */
body[data-theme="dark"] :where(
  .login-card,
  .program-module,
  .module-lessons,
  .lesson-line,
  .responsibility-item,
  .vk-connected,
  .vk-connect-flow,
  .vk-settings label,
  .student-checks label,
  .stats-mini span,
  .profile-stats-grid span,
  .course-meta span,
  .group-meta span,
  .group-summary span,
  .teacher-group-metrics span,
  .activity-stats span,
  .ticket-summary > span,
  .mentor-facts > span,
  .status-progress-summary span,
  .next-status span,
  .plot-status-list span,
  .topic-answer,
  .checkbox-stack,
  .pager,
  .mini-notice-list button.read
) :where(h1, h2, h3, h4, strong, b, label) {
  color: var(--dark-readable-text) !important;
}
body[data-theme="dark"] :where(
  .login-card,
  .program-module,
  .module-lessons,
  .lesson-line,
  .responsibility-item,
  .vk-connected,
  .vk-connect-flow,
  .vk-settings label,
  .student-checks label,
  .stats-mini span,
  .profile-stats-grid span,
  .course-meta span,
  .group-meta span,
  .group-summary span,
  .teacher-group-metrics span,
  .activity-stats span,
  .ticket-summary > span,
  .mentor-facts > span,
  .status-progress-summary span,
  .next-status span,
  .plot-status-list span,
  .topic-answer,
  .checkbox-stack,
  .pager,
  .mini-notice-list button.read
) :where(p, small, em, span:not(.badge):not(.notice-chip):not(.ticket-status):not(.topic-status):not(.access-badge):not(.student-level-badge)) {
  color: var(--dark-readable-muted) !important;
}

/* Icons inside white responsibility tiles became almost invisible. */
body[data-theme="dark"] .responsibility-item > span,
body[data-theme="dark"] .student-program-list .round-btn,
body[data-theme="dark"] .module-num,
body[data-theme="dark"] .lesson-ring {
  background: rgba(88, 185, 108, .14) !important;
  border-color: rgba(88, 185, 108, .36) !important;
  color: #8ee09d !important;
}

/* Group/detail tiles: force readable content without changing layout. */
body[data-theme="dark"] .group-detail-grid section,
body[data-theme="dark"] .group-detail-grid section.group-card,
body[data-theme="dark"] .group-detail-grid .group-card .compact-row,
body[data-theme="dark"] .group-detail-grid .group-card .compact-row.action-row,
body[data-theme="dark"] .group-detail-grid .group-card .empty-inline {
  background: var(--dark-card-readable) !important;
  border-color: var(--dark-readable-border) !important;
  color: var(--dark-readable-text) !important;
}
body[data-theme="dark"] .group-detail-grid :where(h2, h3, h4, strong, b) {
  color: var(--dark-readable-text) !important;
}
body[data-theme="dark"] .group-detail-grid :where(p, small, span:not(.badge):not(.access-badge)) {
  color: var(--dark-readable-muted) !important;
}

/* Plot/document fields and previews that still stayed white. */
body[data-theme="dark"] .screens img,
body[data-theme="dark"] .screens button,
body[data-theme="dark"] .plot-doc-preview,
body[data-theme="dark"] .plot-file-image-preview,
body[data-theme="dark"] .plot-edit-line input,
body[data-theme="dark"] .plot-edit-line textarea,
body[data-theme="dark"] .plot-create-modal input,
body[data-theme="dark"] .plot-create-modal textarea,
body[data-theme="dark"] .plot-create-modal select,
body[data-theme="dark"] .plot-filters-panel input,
body[data-theme="dark"] .plot-filters-panel select {
  background: var(--dark-card-readable) !important;
  border-color: var(--dark-readable-border) !important;
  color: var(--dark-readable-text) !important;
}

/* Login/auth screen should stay readable when user enabled dark mode. */
body[data-theme="dark"] .login-card .field label,
body[data-theme="dark"] .login-card h2,
body[data-theme="dark"] .login-card p {
  color: var(--dark-readable-text) !important;
}
body[data-theme="dark"] .login-card .field input,
body[data-theme="dark"] .login-card .field select {
  background: #0f1914 !important;
  color: var(--dark-readable-text) !important;
  border-color: var(--dark-readable-border) !important;
}

/* Step 108: public landing dark readability */
body[data-theme="dark"] .landing-hero-wrap {
  background:
    linear-gradient(90deg, rgba(6, 24, 23, .50), rgba(6, 24, 23, .26)),
    var(--hero) center/cover;
  color: #fff;
}

body[data-theme="dark"] .landing-hero-wrap :where(h1, strong) {
  color: #fff !important;
}

body[data-theme="dark"] .landing-hero-wrap .hero h1 {
  text-shadow: 0 2px 18px rgba(0, 0, 0, .28);
}

body[data-theme="dark"] .landing-hero-wrap .hero p,
body[data-theme="dark"] .landing-hero-wrap .hero-lead,
body[data-theme="dark"] .landing-author-card p {
  color: rgba(255, 255, 255, .92) !important;
}

body[data-theme="dark"] .landing .brand-text small {
  color: rgba(255, 255, 255, .88) !important;
}

body[data-theme="dark"] .landing .brand-text strong {
  color: #fff !important;
}

body[data-theme="dark"] .landing-hero-wrap .nav-links button {
  color: #fff;
}

body[data-theme="dark"] .landing-hero-wrap .btn.secondary {
  background: rgba(255, 255, 255, .94) !important;
  color: #247338 !important;
  border-color: rgba(255, 255, 255, .35) !important;
}

body[data-theme="dark"] .landing-hero-wrap .btn.secondary:hover {
  background: #fff !important;
}

body[data-theme="dark"] .landing-body {
  background: var(--bg);
}

body[data-theme="dark"] .landing-section-head h2,
body[data-theme="dark"] .landing-card h3,
body[data-theme="dark"] .landing-feature-card h3,
body[data-theme="dark"] .landing-checklist li,
body[data-theme="dark"] .landing-topic-card h3,
body[data-theme="dark"] .landing-step strong,
body[data-theme="dark"] .landing-insight strong {
  color: var(--dark-readable-text) !important;
}

body[data-theme="dark"] .landing-section-lead,
body[data-theme="dark"] .landing-prose p,
body[data-theme="dark"] .landing-card p,
body[data-theme="dark"] .landing-feature-card p,
body[data-theme="dark"] .landing-topic-card p,
body[data-theme="dark"] .landing-step p,
body[data-theme="dark"] .landing-insight p {
  color: rgba(228, 238, 230, .78) !important;
}

body[data-theme="dark"] .landing-section-alt::before {
  background: rgba(255, 255, 255, .03);
}

body[data-theme="dark"] .landing-card,
body[data-theme="dark"] .landing-feature-card,
body[data-theme="dark"] .landing-topic-card,
body[data-theme="dark"] .landing-step {
  background: var(--dark-card-readable) !important;
  border-color: var(--dark-readable-border) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}

body[data-theme="dark"] .landing-insight {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), var(--dark-card-readable)) !important;
  border-color: rgba(88, 185, 108, .24) !important;
}

body[data-theme="dark"] .landing-feature-card:hover,
body[data-theme="dark"] .landing-topic-card:hover,
body[data-theme="dark"] .landing-step:hover,
body[data-theme="dark"] .landing-card:hover {
  border-color: rgba(88, 185, 108, .34) !important;
}

body[data-theme="dark"] .landing .login-panel {
  background: rgba(6, 19, 18, .36);
  backdrop-filter: blur(3px);
}


/* Step 94: group page call spacing and moving right rail cards */
body[data-active="groups"] .group-detail > .group-summary + .group-next-call-hero {
  margin-top: 18px;
}

body[data-active="groups"] .group-next-call-hero {
  margin-bottom: 16px;
}

body[data-active="groups"] .groups-sidebar .panel {
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  will-change: transform;
}

body[data-active="groups"] .groups-sidebar .panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(36,115,56,.78), rgba(88,185,108,.22));
  opacity: .55;
  pointer-events: none;
}

body[data-active="groups"] .groups-sidebar .panel:hover {
  transform: translateY(-3px);
  border-color: rgba(36,115,56,.28);
  box-shadow: 0 18px 34px rgba(18, 44, 26, .10);
}

body[data-theme="dark"][data-active="groups"] .groups-sidebar .panel {
  background: rgba(18, 34, 25, .86) !important;
  border-color: rgba(116, 171, 129, .22) !important;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .24);
}

body[data-theme="dark"][data-active="groups"] .groups-sidebar .panel:hover {
  background: rgba(22, 42, 30, .94) !important;
  border-color: rgba(105, 201, 126, .34) !important;
  box-shadow: 0 22px 42px rgba(0, 0, 0, .34), 0 0 0 1px rgba(105, 201, 126, .08);
}


/* Step 95: calls statistic nearest date alignment */
body[data-active="calls"] .calls-summary-card .calls-summary-row-next {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 4px;
}

body[data-active="calls"] .calls-summary-card .calls-summary-row-next b {
  max-width: none;
  width: 100%;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-align: left;
  line-height: 1.25;
}

body[data-active="calls"] .calls-summary-card .calls-summary-row-next span {
  line-height: 1.2;
}

/* Step 98: dark admin users readability - filters and selected user row only */
body[data-theme="dark"][data-role="admin"] .users-page-layout .user-filter-grid select,
body[data-theme="dark"][data-role="admin"] .users-page-layout .user-filter-grid input,
body[data-theme="dark"][data-role="admin"] .users-page-layout .filters select,
body[data-theme="dark"][data-role="admin"] .users-page-layout .filters input {
  background: #142019;
  color: #eef6ef;
  border-color: rgba(196, 216, 200, .22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

body[data-theme="dark"][data-role="admin"] .users-page-layout .user-filter-grid select:focus,
body[data-theme="dark"][data-role="admin"] .users-page-layout .user-filter-grid input:focus,
body[data-theme="dark"][data-role="admin"] .users-page-layout .filters select:focus,
body[data-theme="dark"][data-role="admin"] .users-page-layout .filters input:focus {
  border-color: rgba(85, 186, 109, .55);
  box-shadow: 0 0 0 3px rgba(85, 186, 109, .12);
  outline: none;
}

body[data-theme="dark"][data-role="admin"] .users-page-layout .user-filter-grid select option {
  background: #142019;
  color: #eef6ef;
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected:hover {
  background: linear-gradient(90deg, rgba(51, 143, 70, .20), rgba(255,255,255,.045));
  border: 1px solid rgba(85, 186, 109, .38);
  border-bottom-color: rgba(85, 186, 109, .38);
  color: #f3faf4;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .22);
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected *,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected * {
  color: inherit;
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected small,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected small,
body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .muted,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .muted {
  color: #b8c9be;
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .badge,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .badge,
body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .status,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .status {
  color: inherit;
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .btn,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .btn {
  background: #17261d;
  color: #86dc97;
  border-color: rgba(134, 220, 151, .25);
}

/* Step 99: admin users — keep role badges readable on selected rows only */
body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .role-badge,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .role-badge,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected:hover .role-badge {
  color: #a9f5b7;
  background: rgba(79, 186, 105, .20);
  border-color: rgba(139, 229, 154, .42);
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .role-badge.role-teacher,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .role-badge.role-teacher,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected:hover .role-badge.role-teacher {
  color: #9bc8ff;
  background: rgba(117, 174, 244, .18);
  border-color: rgba(155, 200, 255, .38);
}

body[data-theme="dark"][data-role="admin"] .admin-user-row.selected .role-badge.role-admin,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected .role-badge.role-admin,
body[data-theme="dark"][data-role="admin"] .admin-user-row:not(.header).selected:hover .role-badge.role-admin {
  color: #ffd08a;
  background: rgba(242, 180, 87, .20);
  border-color: rgba(255, 208, 138, .40);
}

/* Step 100: fix student home hover readability only */
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:hover,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus-visible,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:active,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row.active {
  background: rgba(34, 122, 55, 0.14);
  border-color: rgba(99, 209, 126, 0.32);
  color: var(--ink);
}

body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:hover strong,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus strong,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus-visible strong,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:active strong,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row.active strong {
  color: var(--ink);
}

body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:hover span:not(.badge),
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus span:not(.badge),
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus-visible span:not(.badge),
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:active span:not(.badge),
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row.active span:not(.badge) {
  color: var(--muted);
}

body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:hover .badge,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus .badge,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:focus-visible .badge,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row:active .badge,
body[data-theme="dark"][data-role="student"][data-active="home"] .panel .compact-row.action-row.active .badge {
  opacity: 1;
  filter: none;
}

/* Step 101: remove extra dark progress panel only on student 'Мои курсы' cards */
body[data-role="student"][data-active="courses"] .student-course-card .course-progress-block {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Step 107: remove dark meta chip backgrounds on student 'Мои курсы' cards */
body[data-theme="dark"][data-role="student"][data-active="courses"] .student-course-card .course-meta span {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--muted) !important;
}
body[data-theme="dark"][data-role="student"][data-active="courses"] .student-course-card .course-meta b {
  color: var(--ink) !important;
}

/* Step 102: make community status chips readable in dark theme */
body[data-theme="dark"][data-active="community"] .discussion-panel .topic-row .notice-chip,
body[data-theme="dark"][data-active="community"] .topic-detail .notice-chip,
body[data-theme="dark"][data-active="community"] .similar-topic-card .notice-chip {
  border: 1px solid rgba(232, 238, 230, .18);
  box-shadow: none;
}

body[data-theme="dark"][data-active="community"] .discussion-panel .topic-row .notice-chip.new,
body[data-theme="dark"][data-active="community"] .topic-detail .notice-chip.new,
body[data-theme="dark"][data-active="community"] .similar-topic-card .notice-chip.new {
  background: rgba(88, 185, 108, .24);
  color: #d7ffdf;
  border-color: rgba(137, 232, 156, .38);
}

body[data-theme="dark"][data-active="community"] .discussion-panel .topic-row .notice-chip.read,
body[data-theme="dark"][data-active="community"] .topic-detail .notice-chip.read,
body[data-theme="dark"][data-active="community"] .similar-topic-card .notice-chip.read {
  background: rgba(232, 238, 230, .16);
  color: #f1f8f2;
  border-color: rgba(232, 238, 230, .28);
}

body[data-theme="dark"][data-active="community"] .discussion-panel .topic-row-status .badge.blue,
body[data-theme="dark"][data-active="community"] .similar-topic-card .badge.blue {
  background: rgba(117, 174, 244, .24);
  color: #dceeff;
  border: 1px solid rgba(117, 174, 244, .36);
}

body[data-theme="dark"][data-active="community"] .discussion-panel .topic-row-status .badge.green,
body[data-theme="dark"][data-active="community"] .similar-topic-card .badge.green {
  background: rgba(88, 185, 108, .24);
  color: #d7ffdf;
  border: 1px solid rgba(137, 232, 156, .38);
}


/* Step 103: progress page tab contrast + cleaner course summary stack */
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-tabs button {
  background: rgba(255,255,255,.055);
  border-color: rgba(125, 181, 141, .22);
  color: #ecf7ee;
  box-shadow: none;
}
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-tabs button:hover {
  background: rgba(255,255,255,.085);
  border-color: rgba(125, 181, 141, .3);
}
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-tabs button.active {
  background: linear-gradient(135deg, #54b96d, #3f8f57);
  border-color: #57b36c;
  color: #fff;
}
body[data-theme="dark"][data-role="student"][data-active="progress"] .progress-course-tabs button:not(.active) span {
  background: rgba(167, 227, 180, .14);
  color: #b8efc3;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean > strong {
  grid-column: 1 / -1;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p {
  min-height: 64px;
  align-content: start;
}
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p:last-child {
  grid-column: 1 / -1;
  min-height: 0;
}
@media (max-width: 1380px) {
  body[data-role="student"][data-active="progress"] .progress-course-summary-clean {
    grid-template-columns: 1fr;
  }
  body[data-role="student"][data-active="progress"] .progress-course-summary-clean p,
  body[data-role="student"][data-active="progress"] .progress-course-summary-clean p:last-child {
    min-height: 0;
  }
}

/* Step 104: repair progress overview card layout after step103 */
body[data-role="student"][data-active="progress"] .progress-kpi-grid-filled {
  grid-template-columns: minmax(320px, 1.35fr) repeat(3, minmax(160px, 1fr));
}

body[data-role="student"][data-active="progress"] .progress-course-card-clean .progress-card-overview {
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

body[data-role="student"][data-active="progress"] .progress-course-summary-clean {
  grid-template-columns: 1fr;
  gap: 8px;
}

body[data-role="student"][data-active="progress"] .progress-course-summary-clean p,
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p:last-child {
  grid-column: auto;
  min-height: 0;
  padding: 8px 10px;
}

body[data-role="student"][data-active="progress"] .progress-course-summary-clean p span,
body[data-role="student"][data-active="progress"] .progress-course-summary-clean p b {
  white-space: normal;
  overflow-wrap: break-word;
}

@media (max-width: 1320px) {
  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-course-card-clean .progress-card-overview {
    grid-template-columns: 112px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body[data-role="student"][data-active="progress"] .progress-course-card-clean .progress-card-overview {
    grid-template-columns: 1fr;
  }
}

/* Step 106: profile dropdown hover readability in dark theme */
body[data-theme="dark"] .profile-menu {
  background: #142019 !important;
  border-color: rgba(125, 181, 141, .24) !important;
}

body[data-theme="dark"] .profile-menu button {
  background: transparent !important;
  color: #c9ffd2 !important;
  border: 0 !important;
}

body[data-theme="dark"] .profile-menu button:hover,
body[data-theme="dark"] .profile-menu button:focus-visible {
  background: rgba(83, 190, 108, .18) !important;
  color: #ffffff !important;
  outline: none;
}

body[data-theme="dark"] .profile-menu button[data-profile-action="logout"] {
  color: #ff7b72 !important;
}

body[data-theme="dark"] .profile-menu button[data-profile-action="logout"]:hover,
body[data-theme="dark"] .profile-menu button[data-profile-action="logout"]:focus-visible {
  background: rgba(255, 123, 114, .16) !important;
  color: #ffd6d2 !important;
}

body[data-theme="dark"] .profile-chip:hover,
body[data-theme="dark"] .profile-chip[aria-expanded="true"] {
  background: #1c2b22 !important;
  color: #ffffff !important;
}

body[data-theme="dark"] .profile-chip:hover strong,
body[data-theme="dark"] .profile-chip[aria-expanded="true"] strong {
  color: #ffffff !important;
}

body[data-theme="dark"] .profile-chip:hover small,
body[data-theme="dark"] .profile-chip[aria-expanded="true"] small {
  color: #b8efc3 !important;
}

/* Step 129: community grid audit */
body[data-active="community"] .content {
  padding-top: 8px;
}

.community-page-top {
  margin-bottom: 10px;
}

.community-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0;
  padding: 0;
}

.community-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  flex: 1 1 480px;
  min-width: 0;
}

.community-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.community-toolbar-search {
  width: min(280px, 100%);
  min-width: 200px;
  flex: 1 1 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}

.community-categories-mobile-btn,
.community-topics-mobile-btn {
  display: none;
}

.community-filter-pills {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.community-discussions-filter-pills {
  flex: none;
  width: 100%;
  gap: 6px;
  margin: 0 0 12px;
}

.community-discussions-filter-pills button {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.teacher-dialog-discussions-drawer .community-discussions-filter-pills {
  margin-bottom: 10px;
}

.community-discussions-search-stack {
  position: relative;
  z-index: 2;
}

.community-discussions-search-stack .messenger-drawer-search-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  padding-bottom: 8px;
  background: #fff;
}

.community-discussions-filter-shell {
  overflow: hidden;
  max-height: 132px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.28s ease, opacity 0.24s ease, transform 0.28s ease;
  will-change: max-height, opacity, transform;
  margin-top: 8px;
}

.community-discussions-panel.filters-collapsed .community-discussions-filter-shell {
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  margin-top: 0;
}

@media (max-width: 960px) {
  .community-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .community-toolbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .community-toolbar-search {
    flex: 1 1 100%;
    max-width: none;
  }
}

.community-categories-shell {
  position: relative;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  align-self: stretch;
  flex-shrink: 0;
  z-index: 60;
  overflow: visible;
}

.community-categories-tab,
.community-topics-tab,
.messenger-side-tab {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 56px;
  height: 100%;
  min-height: 100%;
  padding: 18px 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  color: inherit;
  font: inherit;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.community-categories-tab {
  cursor: pointer;
}

.messenger-side-tab:hover,
.messenger-side-tab:focus-visible,
.community-categories-tab:hover,
.community-categories-tab:focus-visible,
.community-topics-tab:hover,
.community-topics-tab:focus-visible {
  border-color: var(--accent-border);
  background: var(--soft-green);
}

.messenger-side-tab.active-tab,
.community-categories-tab.active-tab,
.community-topics-tab.active-tab {
  border-color: rgba(36, 115, 56, 0.28);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(36, 115, 56, 0.12);
}

.community-categories-tab-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.community-categories-glyph {
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
  flex-shrink: 0;
}

.community-categories-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.community-categories-letter {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}

.community-categories-dots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  margin-top: 14px;
}

.community-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d5ddd7;
  flex-shrink: 0;
}

.community-cat-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 115, 56, 0.16);
}

.community-categories-drawer,
.messenger-side-drawer {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  bottom: 0;
  width: min(280px, calc(100vw - 120px));
  min-width: 240px;
  max-width: 280px;
  max-height: calc(100vh - 180px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
  z-index: 80;
}

.community-categories-drawer {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messenger-side-shell.is-open .community-categories-drawer,
.messenger-side-shell.is-open .community-topics-drawer.community-topics-drawer-floating,
.messenger-side-shell.is-drawer-visible .community-topics-drawer.community-topics-drawer-floating,
.teacher-dialog-side-drawer.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

/* Step 139: collapsible topics rail */
.community-topics-shell {
  position: relative;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  align-self: stretch;
  flex-shrink: 0;
  z-index: 4;
  overflow: visible;
}

.community-topics-shell.has-chat-mode {
  align-self: stretch;
}

.community-topics-tab {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 56px;
  height: 100%;
  min-height: 100%;
  padding: 18px 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.community-topics-tab:hover,
.community-topics-tab:focus-visible {
  border-color: var(--accent-border);
  background: var(--soft-green);
}

.community-topics-tab-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.community-topics-glyph {
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
  flex-shrink: 0;
}

.community-topics-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d5ddd7;
  flex-shrink: 0;
  margin-top: 14px;
}

.community-topics-active-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 115, 56, 0.16);
}

.community-topics-drawer.community-topics-drawer-floating {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  bottom: 0;
  width: min(340px, calc(100vw - 150px));
  min-width: 280px;
  max-width: 340px;
  height: auto;
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 16px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
  z-index: 80;
}

.community-topics-drawer {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.community-topics-drawer .community-discussions-head {
  flex-shrink: 0;
}

.community-topics-drawer .community-discussions-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.community-discussions-panel .community-discussions-topic-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.community-discussions-panel .community-discussions-topic-scroll .community-topic-list {
  overflow: visible;
  min-height: auto;
}

.community-topics-drawer .community-discussions-topic-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.community-topics-expanded {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.community-topics-expanded .community-discussions-topic-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.community-topics-shell.is-drawer-visible .community-topics-drawer.community-topics-drawer-floating,
.community-topics-shell.is-open .community-topics-drawer.community-topics-drawer-floating {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.community-main-placeholder {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: min(72vh, 760px);
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.community-main-placeholder-card {
  max-width: 360px;
}

.messenger-drawer-search-wrap {
  margin: 0 0 12px;
}

.messenger-drawer-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f8fa;
  font: inherit;
  font-size: 14px;
}

.messenger-drawer-search:focus {
  outline: none;
  border-color: rgba(36, 115, 56, 0.35);
  box-shadow: 0 0 0 3px rgba(36, 115, 56, 0.1);
}

.messenger-drawer-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.messenger-create-topic-btn {
  width: 100%;
}

.community-discussions-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.community-discussions-toolbar .community-discussions-head-actions {
  margin-left: 0;
}

.community-discussions-toolbar .community-topics-search-expandable {
  margin-left: auto;
}

.community-discussions-toolbar .community-search-count {
  margin-left: 0;
  margin-right: 6px;
}

.community-discussions-toolbar .community-sort-select {
  max-width: 200px;
  transition:
    opacity 0.2s ease,
    max-width 0.28s ease,
    min-width 0.28s ease,
    padding 0.28s ease,
    border-width 0.28s ease,
    visibility 0.2s ease;
}

.community-discussions-toolbar:has(.community-topics-search-expandable:hover) .community-sort-select,
.community-discussions-toolbar:has(.community-topics-search-expandable:focus-within) .community-sort-select,
.community-discussions-toolbar:has(.community-topics-search-expandable.is-open) .community-sort-select {
  opacity: 0;
  visibility: hidden;
  max-width: 0;
  min-width: 0;
  width: 0;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  border-width: 0;
  pointer-events: none;
  overflow: hidden;
}

.community-discussions-toolbar:has(.community-topics-search-expandable:hover) .community-topics-search-expandable,
.community-discussions-toolbar:has(.community-topics-search-expandable:focus-within) .community-topics-search-expandable,
.community-discussions-toolbar:has(.community-topics-search-expandable.is-open) .community-topics-search-expandable {
  max-width: min(320px, calc(100% - 8px));
}

.community-topics-drawer-close {
  flex-shrink: 0;
}

.community-topics-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1750;
  display: flex;
  justify-content: flex-start;
  background: rgba(15, 23, 42, 0.32);
}

.community-topics-mobile-drawer {
  width: min(340px, 92vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 18px 24px;
  background: var(--panel);
  box-shadow: 16px 0 40px rgba(15, 23, 42, 0.2);
  animation: communityCategoriesSlideIn 0.22s ease;
}

.community-topics-mobile-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.community-topics-mobile-body .community-discussions-head {
  display: none;
}

.community-topics-mobile-body .community-discussions-topic-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.community-categories-drawer h2,
.community-categories-panel-scroll h2 {
  margin: 0 0 10px;
  font-size: 14px;
}

.community-categories-panel-scroll h2:not(:first-child) {
  margin-top: 16px;
}

.community-categories-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.community-pinned-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.community-pinned-list > * {
  flex-shrink: 0;
}

.community-topics-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  position: relative;
  z-index: 1;
}

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

.community-discussions-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.community-discussions-head-compact {
  justify-content: flex-end;
  margin-bottom: 8px;
  padding-bottom: 0;
  border-bottom: 0;
}

.community-discussions-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.community-topics-search-expandable {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  max-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f8fa;
  overflow: hidden;
  cursor: text;
  transition:
    max-width 0.28s ease,
    flex-basis 0.28s ease,
    width 0.28s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.community-topics-search-expandable:hover,
.community-topics-search-expandable:focus-within,
.community-topics-search-expandable.is-open {
  flex: 0 1 auto;
  width: auto;
  max-width: min(280px, 58%);
  justify-content: flex-start;
  box-shadow: 0 0 0 3px rgba(36, 115, 56, 0.08);
  border-color: rgba(36, 115, 56, 0.28);
}

.community-topics-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  color: #6b7280;
  pointer-events: none;
  flex-shrink: 0;
}

.community-topics-search-input.community-topics-search-input,
.community-topics-search-input.messenger-drawer-search {
  flex: 0 0 0;
  min-width: 0;
  width: 0;
  max-width: none;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  font-size: 13px;
  box-shadow: none;
  transition: opacity 0.2s ease, flex-basis 0.28s ease, width 0.28s ease;
}

.community-topics-search-expandable:hover .community-topics-search-input,
.community-topics-search-expandable:focus-within .community-topics-search-input,
.community-topics-search-expandable.is-open .community-topics-search-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 72px;
  opacity: 1;
  padding: 0 0 0 10px;
}

.community-topics-search-expandable:hover .community-topics-search-icon,
.community-topics-search-expandable:focus-within .community-topics-search-icon,
.community-topics-search-expandable.is-open .community-topics-search-icon {
  color: var(--accent);
}

.community-topics-search-input:focus {
  outline: none;
  box-shadow: none;
}

.community-sort-select {
  min-width: 168px;
  max-width: 100%;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
}

.community-topic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  min-height: 0;
  align-content: flex-start;
}

.community-topic-list > * {
  flex-shrink: 0;
}

.community-topic-item.has-search-hit .community-topic-open:hover {
  background: #f8fbf8;
}

.community-topic-search-hit {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f8f4;
  border: 1px solid #dfe9e1;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}

.community-search-hit-label {
  display: inline-block;
  margin-right: 4px;
  font-weight: 700;
  color: var(--accent);
}

.community-search-mark {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(36, 115, 56, 0.18);
  color: inherit;
  font-weight: 700;
}

.community-search-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.community-search-count:empty,
.community-search-count[hidden] {
  display: none !important;
}

.community-search-empty strong {
  display: block;
  margin-bottom: 4px;
}

.community-topic-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.community-topic-item:hover {
  border-color: var(--accent-border);
  background: #fafcfa;
}

.community-topic-item.active {
  border-color: var(--accent-border);
  background: #f5faf6;
  box-shadow: inset 3px 0 0 var(--accent);
}

.community-topic-open {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px 10px 14px;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s ease;
}

.community-topic-open:hover {
  background: rgba(36, 115, 56, 0.04);
}

.community-topic-item.active .community-topic-open:hover {
  background: transparent;
}

.community-topic-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.community-topic-badges .badge,
.community-topic-badges .notice-chip {
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 7px;
}

.community-topic-open h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  word-break: normal;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-topic-item-compact .community-topic-open {
  gap: 4px;
  padding: 8px 10px 8px 12px;
}

.community-topic-item-compact .community-topic-open h3 {
  -webkit-line-clamp: 3;
}

.community-topic-excerpt {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-topic-last-message {
  margin: 0;
  padding: 6px 8px;
  border-radius: 7px;
  background: #f3f8f4;
  border: 1px solid #e3ece5;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-topic-last-author {
  font-weight: 700;
  color: var(--accent);
}

.community-topic-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  min-width: 0;
}

.community-topic-meta,
.community-topic-activity {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
}

.community-topic-meta span {
  color: var(--ink);
  font-weight: 600;
}

.community-topic-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0f4f1;
  border: 1px solid #dfe7e0;
  font-size: 11px;
  line-height: 1.3;
  color: #4d5852;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.community-topic-attachment-icon {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
}

.community-topic-unread {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.community-topic-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 10px 0;
}

.community-chat-main,
.community-chat-placeholder {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: min(72vh, 780px);
  max-height: calc(100vh - 180px);
}

.community-chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  background: linear-gradient(180deg, #f8fbf8 0%, #ffffff 100%);
  border-style: dashed;
}

.community-chat-placeholder h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.community-sidebar-wrap {
  min-width: 0;
  align-self: start;
}

.community-sidebar-wrap .right-rail {
  gap: 10px;
}

.community-sidebar-wrap .right-rail .panel {
  padding: 14px 16px;
  box-shadow: none;
  border: 1px solid var(--line);
  background: #fafbfa;
}

.community-sidebar-wrap .right-rail h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #4d5852;
}

.community-sidebar-wrap .ask-card {
  background: #f7faf7;
}

.community-sidebar-wrap .ask-card .btn {
  font-size: 13px;
}

.teacher-dialog-panel .teacher-dialog-lead {
  margin: 0 0 10px;
  font-size: 13px;
}

.teacher-dialog-list {
  display: grid;
  gap: 8px;
}

.teacher-dialog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.teacher-dialog-item:hover {
  background: var(--soft-green);
}

.teacher-dialog-main strong {
  display: block;
  margin-bottom: 2px;
}

.teacher-dialog-topic {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.teacher-dialog-item p {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
}

.teacher-dialog-item small {
  color: var(--muted);
  font-size: 12px;
}

.teacher-dialog-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

body[data-theme="dark"] .teacher-dialog-item {
  border-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-item:hover {
  background: #1a2a20;
}

body[data-theme="dark"] .teacher-dialog-item p {
  color: #eaf3ec;
}

/* Step 149: private teacher dialog mode */
.teacher-private-layout {
  display: grid;
  gap: 12px;
  min-height: min(72vh, 760px);
}

.teacher-private-layout.has-student-list {
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}

.teacher-private-students {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.teacher-private-students-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.teacher-private-students-head h2 {
  margin: 0;
  font-size: 16px;
}

.teacher-private-students-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  overflow: auto;
  max-height: min(72vh, 760px);
}

.teacher-private-student-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.teacher-private-student-row:hover,
.teacher-private-student-row.active {
  border-color: rgba(36, 115, 56, 0.35);
  background: var(--soft-green);
}

.teacher-private-student-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.teacher-private-student-main strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.teacher-private-student-preview {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-private-student-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
}


.teacher-private-student-row .teacher-private-status {
  justify-self: end;
  font-size: 10px;
  padding: 4px 8px;
}

.teacher-private-status.new {
  background: rgba(214, 168, 40, 0.16);
  color: #8a6400;
}

.messenger-back-btn {
  display: none;
  flex-shrink: 0;
  margin-right: 8px;
}

.messenger-empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(72vh, 760px);
  text-align: center;
  padding: 24px;
}

.groups-messenger-layout .groups-card-list {
  display: grid;
  gap: 8px;
}

.groups-messenger-layout .group-card {
  margin: 0;
}

.groups-messenger-layout .group-card.chat-open {
  border-color: rgba(36, 115, 56, 0.44);
  box-shadow: inset 0 0 0 1px rgba(36, 115, 56, 0.18);
}

.student-appeal-toolbar {
  display: flex;
  gap: 10px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.student-appeal-toolbar .compact-field {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.student-appeal-toolbar select {
  width: 100%;
}

.teacher-private-chat-head {
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .teacher-private-layout.has-student-list.mobile-chat-open .teacher-private-students,
  .teacher-private-layout.has-student-list.mobile-chat-open .groups-list-panel {
    display: none;
  }

  .teacher-private-layout.has-student-list:not(.mobile-chat-open) .messenger-chat-panel,
  .teacher-private-layout.has-student-list:not(.mobile-chat-open) .messenger-empty-chat {
    display: none;
  }

  .messenger-back-btn {
    display: inline-flex;
  }

  .teacher-private-layout.has-student-list {
    grid-template-columns: 1fr;
  }
}

body[data-theme="dark"] .student-appeal-toolbar {
  background: #141c18;
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-private-status.new {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.teacher-private-student-main small {
  font-size: 11px;
  color: var(--muted);
}

.teacher-private-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.teacher-private-chat {
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 760px);
  padding: 0;
  overflow: hidden;
}

.teacher-private-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.teacher-private-chat-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.teacher-private-chat-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.teacher-private-chat-meta {
  margin: 0;
  font-size: 13px;
}

.teacher-private-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.teacher-private-status.answered {
  background: rgba(36, 115, 56, 0.12);
  color: var(--accent);
}

.teacher-private-status.pending {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.teacher-private-status.neutral {
  background: var(--soft-green);
  color: var(--muted);
}

.teacher-private-feed {
  flex: 1 1 auto;
  min-height: 280px;
  max-height: none;
}

.teacher-private-empty-feed,
.teacher-private-students-empty,
.teacher-private-chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.teacher-private-chat-empty {
  min-height: 320px;
}

.teacher-dialog-composer {
  border-top: 1px solid var(--line);
}

.teacher-dialog-page {
  display: flex;
  flex-direction: column;
  min-height: min(calc(100vh - 180px), 760px);
}

.teacher-dialog-page-chat {
  flex: 1 1 auto;
  min-height: min(calc(100vh - 180px), 760px);
}

.teacher-dialog-page .teacher-private-feed {
  flex: 1 1 auto;
  min-height: 320px;
}

.teacher-private-chat .community-chat-avatar-wrap {
  flex-shrink: 0;
}

:root {
  --messenger-chat-wallpaper-base: #dce8e2;
  --messenger-chat-wallpaper-image: url("assets/messenger-chat-pattern-space-light.svg");
  --messenger-chat-wallpaper-size: 281.25px 609px;
}

body[data-theme="dark"] {
  --messenger-chat-wallpaper-base: #18191d;
  --messenger-chat-wallpaper-image: url("assets/messenger-chat-pattern-space-dark.svg");
}

.messenger-chat-wallpaper,
.teacher-dialog-chat-body,
.teacher-private-feed,
.community-chat-feed {
  background-color: var(--messenger-chat-wallpaper-base);
  background-image: var(--messenger-chat-wallpaper-image);
  background-size: var(--messenger-chat-wallpaper-size);
  background-position: 0 0;
  background-repeat: repeat;
}

.teacher-dialog-chat-body > .teacher-private-feed,
.teacher-dialog-chat-body > .community-chat-feed {
  background-color: transparent;
  background-image: none;
}

.teacher-dialog-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.teacher-dialog-pinned {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px 16px;
  border-bottom: 1px solid #dbe8de;
  background: linear-gradient(180deg, #f8fbf8 0%, #f3f7f3 100%);
}

.teacher-dialog-pinned-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.4;
  opacity: 0.85;
}

.teacher-dialog-pinned-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.teacher-dialog-pinned-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.teacher-dialog-pinned-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.teacher-dialog-pinned-author {
  font-weight: 700;
}

.teacher-dialog-pinned-time {
  font-size: 11px;
  color: var(--muted);
}

.teacher-dialog-pinned-menu-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}

.teacher-dialog-pinned-menu-btn {
  opacity: 1;
}

.teacher-dialog-pinned-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  min-width: 148px;
}

.messenger-unpin-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 22, 18, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.messenger-unpin-alert {
  width: min(360px, 100%);
  padding: 22px 20px 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1c1c1e;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.messenger-unpin-alert h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: #f2f2f7;
}

.messenger-unpin-alert p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #8e8e93;
}

.messenger-unpin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.messenger-unpin-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.messenger-unpin-btn:hover {
  transform: translateY(-1px);
}

.messenger-unpin-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f7;
}

.messenger-unpin-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
}

.messenger-unpin-btn-confirm {
  background: #007aff;
  color: #fff;
}

.messenger-unpin-btn-confirm:hover {
  background: #0066d6;
}

.teacher-dialog-page-chat .teacher-private-feed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 12px;
  gap: 10px;
  scroll-behavior: smooth;
}

.community-chat-feed .community-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: min(85%, 640px);
}

.community-chat-feed .community-chat-message.is-other {
  align-self: flex-start;
  margin-right: auto;
}

.community-chat-feed .community-chat-message.is-mine {
  flex-direction: row-reverse;
  align-self: flex-end;
  margin-left: auto;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-avatar-wrap {
  display: none;
}

.community-chat-feed .community-chat-message.is-send-failed .community-chat-bubble-tg {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.community-chat-feed .community-chat-message.is-send-failed .community-chat-time {
  color: #dc2626;
}

.community-chat-feed .community-chat-message.is-pending-send .community-chat-time {
  opacity: 0.72;
}

.community-chat-feed .community-chat-bubble-tg {
  position: relative;
  width: fit-content;
  max-width: min(85%, 640px);
  min-width: min-content;
  padding: 8px 10px 6px;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: visible;
}

.community-chat-feed .community-chat-content {
  display: block;
  min-width: min-content;
}

.community-chat-feed .community-chat-body {
  display: block;
  max-width: 100%;
  min-width: min-content;
}

.community-chat-feed .community-chat-body-row {
  display: block;
  width: fit-content;
  max-width: min(85%, 640px);
  line-height: 1.45;
}

.community-chat-feed .community-chat-body-row > .community-chat-text {
  display: inline;
  min-width: 0;
  max-width: none;
}

.community-chat-feed .community-chat-body-row > .community-message-delete-confirm,
.community-chat-feed .community-chat-body-row > .community-message-edit-form {
  display: block;
  width: 100%;
  margin-top: 8px;
  clear: both;
}

.community-chat-feed .community-chat-body-row > .community-chat-tail {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: bottom;
  margin: 0 0 1px 6px;
  white-space: nowrap;
}

.community-chat-feed .community-chat-author-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.community-chat-feed .community-chat-author-line .community-chat-tail {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
  margin-bottom: 0;
}

.community-chat-feed .community-chat-author-line .community-chat-author {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  cursor: default;
}

.community-chat-feed .community-chat-message.from-teacher.is-other .community-chat-author-line .community-chat-author {
  color: #1f6b3f;
}

.community-chat-feed .community-chat-message.is-other .community-chat-bubble-tg {
  background: #fff;
  border-color: #dce8de;
  border-radius: 18px 18px 18px 6px;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-bubble-tg {
  background: #dff0e2;
  border-color: #c5dfc9;
  border-radius: 18px 18px 6px 18px;
}

.community-chat-feed .community-chat-message.from-teacher.is-other .community-chat-bubble-tg {
  background: #effaf0;
  border-color: #b9dcc0;
}

.community-chat-feed .community-chat-message.is-deleted .community-chat-bubble-tg {
  background: #f8f9f8;
  border-color: #e4ebe5;
}

.community-chat-feed .community-chat-content .community-chat-quote,
.community-chat-feed .community-chat-content .community-message-attachments,
.community-chat-feed .community-chat-content .community-message-delete-confirm,
.community-chat-feed .community-chat-content .community-message-edit-input,
.community-chat-feed .community-chat-content .community-message-edit-form,
.community-chat-feed .community-chat-body .community-chat-quote,
.community-chat-feed .community-chat-body .community-message-attachments,
.community-chat-feed .community-chat-body .community-message-delete-confirm,
.community-chat-feed .community-chat-body .community-message-edit-input,
.community-chat-feed .community-chat-body .community-message-edit-form {
  display: block;
  width: 100%;
}

.community-chat-feed .community-chat-author-line button.community-chat-author {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.community-chat-feed .community-chat-author-line button.community-chat-author:hover {
  color: var(--accent);
}

.community-chat-feed .community-chat-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: pre-wrap;
}

.community-chat-feed .community-chat-body > .community-chat-text,
.community-chat-feed .community-chat-body-row > .community-chat-text {
  color: inherit;
  opacity: 1;
  visibility: visible;
}

.community-chat-feed .community-chat-body > .community-chat-text {
  display: block;
}

.community-chat-feed .community-chat-body-row > .community-chat-text {
  display: inline;
}

.community-chat-feed .community-chat-content > .community-chat-text {
  display: block;
}

.community-chat-feed .community-chat-tail {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  margin-left: 6px;
  margin-bottom: 1px;
  white-space: nowrap;
}

.community-chat-feed .community-chat-time {
  font-size: 11px;
  line-height: 1;
  color: rgba(15, 23, 42, 0.42);
  white-space: nowrap;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-time {
  color: rgba(15, 23, 42, 0.46);
}

.community-chat-feed .community-chat-tail .community-message-menu-wrap {
  margin-left: 0;
}

.community-chat-feed .community-chat-bubble-tg .community-message-reactions {
  margin-top: 4px;
}

.community-chat-feed .community-message-menu-wrap {
  position: relative;
  z-index: 2;
  margin-left: 2px;
}

.community-chat-feed .community-message-menu-btn {
  opacity: 0.72;
}

.community-chat-feed .community-chat-message:hover .community-message-menu-btn,
.community-chat-feed .community-message-menu-wrap:focus-within .community-message-menu-btn,
.community-chat-feed .community-message-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.community-chat-feed .community-chat-message:hover .community-chat-bubble-tg,
.community-chat-feed .community-chat-message:focus-within .community-chat-bubble-tg {
  transform: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.teacher-dialog-page-chat .teacher-dialog-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px 12px;
}

.teacher-dialog-page-chat .community-chat-input-row {
  gap: 10px;
}

.teacher-dialog-page-chat .community-chat-input-row textarea,
.messenger-composer-textarea {
  min-height: 52px;
  max-height: 200px;
  resize: none;
  overflow-y: hidden;
  overflow-x: hidden;
  border-radius: 16px;
  border: 1px solid #dbe8de;
  background: #f8fbf8;
  padding: 11px 14px;
  line-height: 1.45;
  box-sizing: border-box;
  field-sizing: content;
}

.teacher-dialog-page-chat .teacher-dialog-composer .community-attach-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  font-size: 18px;
}

.teacher-dialog-page-chat .teacher-dialog-composer .btn {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 14px;
}

.teacher-dialog-page-chat .community-attach-btn {
  border-radius: 12px;
}

@media (max-width: 720px) {
  .community-chat-feed .community-chat-message {
    max-width: min(88%, 100%);
  }
}

body[data-theme="dark"] .teacher-dialog-chat-body > .teacher-private-feed,
body[data-theme="dark"] .teacher-dialog-chat-body > .community-chat-feed {
  background-color: transparent;
  background-image: none;
}

body[data-theme="dark"] .teacher-dialog-pinned {
  background: linear-gradient(180deg, #18221c 0%, #141c18 100%);
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-pinned-text {
  color: #e8ede9;
}

body[data-theme="dark"] .teacher-dialog-pinned-menu-btn:hover,
body[data-theme="dark"] .teacher-dialog-pinned-menu-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="light"] .messenger-unpin-alert {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

body[data-theme="light"] .messenger-unpin-alert h2 {
  color: var(--ink);
}

body[data-theme="light"] .messenger-unpin-alert p {
  color: var(--muted);
}

body[data-theme="light"] .messenger-unpin-btn-cancel {
  background: #eef2ef;
  color: var(--ink);
}

body[data-theme="light"] .messenger-unpin-btn-cancel:hover {
  background: #e4ebe6;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-mine .community-chat-time {
  color: rgba(234, 243, 236, 0.52);
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-other .community-chat-time {
  color: rgba(232, 237, 233, 0.48);
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-other .community-chat-bubble-tg {
  background: #1a2420;
  border-color: #2f4236;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-mine .community-chat-bubble-tg {
  background: #1f3a28;
  border-color: #3a5a42;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-mine .community-chat-text {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.from-teacher.is-other .community-chat-bubble-tg {
  background: #1a2a20;
  border-color: #3a5a42;
}

body[data-theme="dark"] .teacher-dialog-page-chat .teacher-dialog-composer {
  background: #141c18;
  border-top-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-page-chat .community-chat-input-row textarea {
  background: #1a2420;
  border-color: #2f4236;
  color: #e8ede9;
}

body[data-theme="dark"] .community-chat-feed .community-message-menu-btn:hover,
body[data-theme="dark"] .community-chat-feed .community-message-menu-btn:focus-visible {
  background: #243028;
}

body[data-theme="dark"] .teacher-private-student-row {
  border-color: #2a3a30;
}

body[data-theme="dark"] .teacher-private-student-row:hover,
body[data-theme="dark"] .teacher-private-student-row.active {
  background: #1a2a20;
  border-color: #3a5a42;
}

body[data-theme="dark"] .teacher-private-student-preview,
body[data-theme="dark"] .teacher-private-student-main small {
  color: #b8c5bb;
}

body[data-theme="dark"] .teacher-private-status.pending {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

body[data-theme="dark"] .teacher-private-status.answered {
  color: #86efac;
  background: rgba(134, 239, 172, 0.12);
}

@media (max-width: 820px) {
  .teacher-private-layout.has-student-list {
    grid-template-columns: 1fr;
  }

  .teacher-private-students-list {
    max-height: 220px;
  }

  .teacher-private-chat {
    min-height: 420px;
  }
}

/* Teacher dialog: messenger card layout */
body[data-active="teacherDialog"] .content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 68px);
  max-height: calc(100vh - 68px);
  min-height: 0;
  overflow: hidden;
  width: 100%;
  max-width: none;
  padding: 6px 8px 8px;
  box-sizing: border-box;
}

.messenger-page-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}

body[data-active="teacherDialog"] .teacher-dialog-card {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.teacher-dialog-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: min(calc(100vh - 220px), 760px);
  max-height: min(calc(100vh - 220px), 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0;
  box-shadow: none;
}

.teacher-dialog-spaces-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.teacher-dialog-spaces-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border-bottom: none;
  background: transparent;
}

.teacher-dialog-spaces-bar.has-active-topic {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.teacher-dialog-spaces-bar.has-active-topic .teacher-dialog-space-card {
  flex: 0 1 clamp(150px, 20vw, 220px);
  width: auto;
  max-width: none;
}

.teacher-dialog-space-topic-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 48px;
  padding: 4px 6px 4px 10px;
  border: 1px solid rgba(36, 115, 56, 0.34);
  border-radius: 8px;
  background: rgba(36, 115, 56, 0.05);
  box-shadow: none;
}

.teacher-dialog-space-topic-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.teacher-dialog-space-topic-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-dialog-space-topic-meta {
  display: block;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-dialog-space-topic-meta .teacher-private-status {
  display: inline-flex;
  vertical-align: baseline;
}

.teacher-dialog-space-topic-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.teacher-dialog-space-topic-tools .topic-mini-btn,
.teacher-dialog-space-topic-tools .icon-btn {
  flex-shrink: 0;
}

.teacher-dialog-space-topic-close {
  margin-left: 2px;
}

.teacher-dialog-topic-mobile-bar {
  display: none;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.teacher-dialog-page-chat.has-topic-in-header .teacher-dialog-chat-body {
  border-top: 0;
}

.teacher-dialog-space-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 48px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.teacher-dialog-space-card:hover:not(.active) {
  background: #fafbfc;
  border-color: #d8dee4;
}

.teacher-dialog-space-card.active {
  background: rgba(36, 115, 56, 0.05);
  border-color: rgba(36, 115, 56, 0.34);
  box-shadow: none;
}

.teacher-dialog-space-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  color: var(--accent);
}

.teacher-dialog-space-card .teacher-dialog-space-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.teacher-dialog-space-card .teacher-dialog-space-body strong {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-dialog-space-card .teacher-dialog-space-body .muted {
  font-size: 10px;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teacher-dialog-space-card.has-mentor-context {
  grid-template-columns: 18px minmax(96px, 0.68fr) minmax(0, 1.5fr) auto;
  align-items: center;
  max-height: 52px;
  min-height: 46px;
}

.teacher-dialog-space-mentor-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.teacher-dialog-space-mentor-kicker {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.1;
}

.teacher-dialog-space-mentor-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-dialog-space-mentor-meta {
  display: block;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-dialog-space-card.has-mentor-context .teacher-private-status {
  flex-shrink: 0;
  margin-left: 6px;
  font-size: 10px;
  padding: 3px 7px;
}

.teacher-dialog-workspace {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.teacher-dialog-workspace.is-community-rail-only {
  grid-template-columns: 56px minmax(0, 1fr);
}

.teacher-dialog-workspace.has-community-drawer {
  grid-template-columns: minmax(336px, 416px) minmax(0, 1fr);
}

.teacher-dialog-workspace.is-mentor-chat-only {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-workspace.is-mentor-chat-only > * {
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
}

.teacher-dialog-workspace.is-mentor-list {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.teacher-dialog-sidebar.is-drawer-collapsed {
  display: grid;
  grid-template-columns: 56px;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-sidebar.has-drawer-open {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-sidebar.mentor-list-sidebar {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #fff;
}

.teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-pane {
  height: 100%;
}

.teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-main {
  height: 100%;
  min-height: 0;
}

.teacher-dialog-workspace > .teacher-dialog-sidebar {
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-workspace > .messenger-chat-panel {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* Messenger right chat: full-height column layout */
.teacher-dialog-workspace .messenger-chat-panel,
.teacher-dialog-workspace .teacher-dialog-page-chat,
.teacher-dialog-workspace .teacher-dialog-community-chat,
.teacher-dialog-workspace .teacher-dialog-chat-pane,
.teacher-dialog-workspace .teacher-dialog-empty-state {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0 !important;
  max-height: none;
  overflow: hidden;
}

.teacher-dialog-workspace .messenger-chat-panel > header,
.teacher-dialog-workspace .teacher-dialog-tg-head,
.teacher-dialog-workspace .teacher-private-chat-head {
  flex: 0 0 auto;
}

.teacher-dialog-workspace .messenger-chat-panel > .teacher-dialog-chat-body,
.teacher-dialog-workspace .teacher-dialog-page-chat > .teacher-dialog-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.teacher-dialog-workspace .teacher-dialog-chat-body > .teacher-private-feed,
.teacher-dialog-workspace .teacher-dialog-chat-body > .community-chat-feed {
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
}

.teacher-dialog-workspace .messenger-chat-panel > .teacher-dialog-composer,
.teacher-dialog-workspace .teacher-dialog-page-chat > .teacher-dialog-composer,
.teacher-dialog-workspace .messenger-chat-panel > .community-chat-composer {
  flex: 0 0 auto;
  margin-top: 0;
}

.teacher-dialog-workspace > .teacher-dialog-empty-state,
.teacher-dialog-workspace > .teacher-dialog-chat-pane,
.teacher-dialog-workspace > .teacher-private-chat,
.teacher-dialog-workspace > .messenger-empty-chat,
.teacher-dialog-workspace > .teacher-dialog-page-chat {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* Teacher dialog: Telegram-style mentor layout */
.teacher-dialog-page.teacher-dialog-mentor-layout {
  display: grid;
  height: min(calc(100vh - 180px), 760px);
  max-height: min(calc(100vh - 180px), 760px);
  min-height: 0;
  overflow: hidden;
}

.teacher-dialog-workspace.is-mentor-list.teacher-private-layout.has-student-list,
.teacher-dialog-workspace.has-community-drawer.teacher-private-layout.has-student-list {
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.teacher-dialog-workspace.is-mentor-list.teacher-private-layout.has-student-list {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.teacher-dialog-workspace.has-community-drawer.teacher-private-layout.has-student-list {
  grid-template-columns: minmax(336px, 416px) minmax(0, 1fr);
}

.teacher-dialog-workspace.is-community-rail-only.teacher-private-layout.has-student-list {
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.teacher-dialog-workspace.is-mentor-list.teacher-private-layout.has-student-list > *,
.teacher-dialog-workspace.has-community-drawer.teacher-private-layout.has-student-list > *,
.teacher-dialog-workspace.is-community-rail-only.teacher-private-layout.has-student-list > * {
  min-width: 0;
  min-height: 0;
}

.teacher-dialog-sidebar {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  background: #f4f4f5;
}

.teacher-dialog-sidebar.teacher-private-students {
  display: grid;
}

.teacher-dialog-sidebar.drawer-chats .teacher-dialog-sidebar-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.teacher-dialog-sidebar.drawer-panel .teacher-dialog-sidebar-body {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-nav-rail {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 4px;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  background: #ececee;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.teacher-dialog-nav-tab {
  width: 100%;
  min-height: 88px;
  padding: 10px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
}

.teacher-dialog-nav-tab.messenger-side-tab {
  width: 100%;
  height: auto;
  min-height: 88px;
}

.teacher-dialog-nav-tab.active-tab {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(36, 115, 56, 0.18);
}

.teacher-dialog-nav-icon {
  font-size: 16px;
  line-height: 1;
  color: var(--accent);
}

.teacher-dialog-sidebar-body {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
}

.teacher-dialog-side-drawer {
  position: relative;
  left: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  background: #fff;
}

.teacher-dialog-sidebar.drawer-panel .teacher-dialog-side-drawer {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.community-discussions-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.community-discussions-panel-head {
  flex-shrink: 0;
}

.teacher-dialog-discussions-drawer .community-topic-list {
  flex: none;
  overflow: visible;
  min-height: auto;
  padding-right: 0;
}

.teacher-dialog-discussions-drawer .community-discussions-topic-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  margin-right: 0;
  padding: 0 2px 12px 12px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.24) transparent;
  -webkit-overflow-scrolling: touch;
}

.teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar {
  width: 7px;
}

.teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(15, 23, 42, 0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(15, 23, 42, 0.32);
  background-clip: padding-box;
}

.teacher-dialog-discussions-drawer {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 12px 0 0;
}

.teacher-dialog-discussions-drawer .community-discussions-panel-head {
  padding: 0 12px;
}

body[data-theme="dark"] .teacher-dialog-discussions-drawer .community-discussions-topic-scroll {
  scrollbar-color: rgba(226, 232, 240, 0.32) transparent;
}

body[data-theme="dark"] .teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(226, 232, 240, 0.26);
  background-clip: padding-box;
}

body[data-theme="dark"] .teacher-dialog-discussions-drawer .community-discussions-topic-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(226, 232, 240, 0.4);
  background-clip: padding-box;
}

.teacher-dialog-discussions-drawer .community-discussions-head,
.teacher-dialog-discussions-drawer .community-topics-search-expandable,
.teacher-dialog-discussions-drawer .community-discussions-filter-pills,
.teacher-dialog-discussions-drawer .community-discussions-hint {
  flex-shrink: 0;
}

.messenger-recent-contacts {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}

.messenger-recent-contacts-head h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.messenger-recent-contacts-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.messenger-recent-contact {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  max-width: 72px;
  padding: 4px 2px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

.messenger-recent-contact:hover {
  background: rgba(15, 23, 42, 0.04);
}

.messenger-recent-contact.active {
  background: var(--accent-soft, rgba(34, 197, 94, 0.12));
}

.messenger-recent-contact-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
}

.messenger-recent-contact-first,
.messenger-recent-contact-last {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messenger-recent-contact-last {
  font-size: 10px;
  color: var(--muted);
}

.messenger-recent-unread {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.community-discussions-panel.has-recent-contacts {
  min-height: 0;
}

.community-discussions-panel.has-recent-contacts .community-discussions-topic-scroll {
  flex: 1 1 auto;
  min-height: 120px;
}

.peer-direct-chat-pane .teacher-dialog-space-mentor-kicker {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

body[data-theme="dark"] .messenger-recent-contact:hover {
  background: rgba(255, 255, 255, 0.05);
}

.community-categories-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.community-categories-panel-foot {
  flex-shrink: 0;
}

.community-categories-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 10px;
  padding-bottom: 12px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.teacher-dialog-categories-drawer {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 12px 12px 0;
}

.teacher-dialog-categories-drawer .community-categories-panel-foot {
  padding-bottom: 12px;
}

.community-categories-drawer .community-categories-panel {
  min-height: 0;
  max-height: 100%;
}

.community-categories-drawer .community-categories-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.teacher-dialog-chats-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-chats-main {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.teacher-dialog-chats-main-hint {
  display: flex;
  align-items: flex-start;
  grid-template-columns: minmax(0, 1fr);
}

.teacher-dialog-spaces-list {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  max-height: min(42%, 220px);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.teacher-dialog-space-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.teacher-dialog-space-row:hover:not(.active) {
  background: #f7f8fa;
}

.teacher-dialog-space-row.active {
  background: rgba(36, 115, 56, 0.1);
  border-color: rgba(36, 115, 56, 0.28);
}

.teacher-dialog-space-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.teacher-dialog-space-body strong {
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-dialog-space-body .muted {
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.teacher-dialog-space-hint {
  padding: 12px 14px;
  background: #fafbfc;
  width: 100%;
}

.teacher-dialog-messenger-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
}

.teacher-dialog-messenger-toolbar .btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.teacher-dialog-messenger-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.teacher-dialog-community-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-guide-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
}

.teacher-dialog-guide-composer {
  flex-shrink: 0;
  margin-top: auto;
}

.community-guide-message {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.community-topic-empty-hint {
  padding: 12px 16px;
}

.pin-row.active,
.category-row.active {
  background: rgba(36, 115, 56, 0.1);
}

.teacher-dialog-folders-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 6px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  background: #ececee;
  flex-shrink: 0;
  min-height: 0;
}

.teacher-dialog-folder-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.teacher-dialog-folder-rail:hover:not(.active) {
  background: rgba(255, 255, 255, 0.55);
}

.teacher-dialog-folder-rail.active {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(36, 115, 56, 0.18);
}

.teacher-dialog-folder-rail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1;
}

.teacher-dialog-folder-rail.active .teacher-dialog-folder-rail-icon {
  background: rgba(36, 115, 56, 0.12);
}

.teacher-dialog-folder-rail-label {
  max-width: 100%;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-dialog-folder-rail.active .teacher-dialog-folder-rail-label {
  color: var(--accent);
  font-weight: 700;
}

.teacher-dialog-folder-rail-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.teacher-dialog-chats-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.teacher-dialog-chats-toolbar {
  flex-shrink: 0;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.teacher-dialog-chats-search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: none;
  border-radius: 999px;
  background: #f0f2f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='6' cy='6' r='4'/%3E%3Cpath d='M9 9l3 3'/%3E%3C/svg%3E") 12px center no-repeat;
  font: inherit;
  font-size: 14px;
  color: inherit;
}

.teacher-dialog-chats-search:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(36, 115, 56, 0.35);
}

.teacher-dialog-chats-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.teacher-dialog-chat-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.teacher-dialog-chat-row:hover:not(.active) {
  background: #f5f7f8;
}

.teacher-dialog-chat-row.active {
  background: rgba(36, 115, 56, 0.1);
}

.teacher-dialog-chat-row-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.teacher-dialog-chat-row-top,
.teacher-dialog-chat-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.teacher-dialog-chat-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.teacher-dialog-chat-row-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.teacher-dialog-chat-row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.teacher-dialog-chat-unread {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.teacher-dialog-list-group {
  display: flex;
  flex-direction: column;
}

.teacher-dialog-list-group-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f0f2f5;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.teacher-private-students-empty {
  padding: 28px 16px;
  text-align: center;
}

.teacher-dialog-mentor-layout .teacher-dialog-chat-pane,
.teacher-dialog-mentor-layout .teacher-dialog-empty-state {
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.teacher-dialog-mentor-layout .teacher-dialog-page-chat,
.teacher-dialog-mentor-layout .teacher-private-chat.teacher-dialog-page-chat {
  min-height: 0 !important;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
}

.teacher-dialog-mentor-layout .teacher-private-chat-head,
.teacher-dialog-mentor-layout .teacher-dialog-tg-head {
  flex-shrink: 0;
}

.teacher-dialog-mentor-layout .teacher-dialog-composer {
  flex-shrink: 0;
}

.teacher-dialog-mentor-layout .teacher-dialog-page .teacher-private-feed,
.teacher-dialog-mentor-layout .teacher-dialog-page-chat .teacher-private-feed {
  flex: 1 1 auto;
  min-height: 0 !important;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.teacher-dialog-mentor-layout .teacher-dialog-empty-state {
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}

.teacher-dialog-mentor-layout .teacher-dialog-empty-state p {
  margin: 0;
  font-size: 15px;
  max-width: 28ch;
  color: var(--muted);
}

.teacher-dialog-mentor-layout .teacher-dialog-tg-head {
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  flex-shrink: 0;
}

.teacher-dialog-mentor-layout .teacher-dialog-tg-head-main h2 {
  margin: 0;
  font-size: 16px;
}

.teacher-dialog-mentor-layout .teacher-dialog-tg-head-main .teacher-private-chat-meta {
  margin: 2px 0 0;
  font-size: 12px;
}

.teacher-dialog-mentor-layout .teacher-dialog-tg-head-main .teacher-private-status {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 11px;
  vertical-align: middle;
}

.teacher-dialog-topic-head {
  align-items: center;
}

.teacher-dialog-topic-head .teacher-dialog-tg-head-main {
  flex: 1 1 auto;
  min-width: 0;
}

.teacher-dialog-topic-head .teacher-dialog-tg-head-main h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-dialog-topic-head-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.teacher-dialog-topic-head-tools .topic-mini-btn,
.teacher-dialog-topic-head-tools .icon-btn {
  flex-shrink: 0;
}

.teacher-dialog-mentor-layout .teacher-dialog-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.teacher-dialog-mentor-layout .teacher-dialog-pinned {
  flex-shrink: 0;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.teacher-dialog-mentor-layout .teacher-dialog-pinned-text {
  -webkit-line-clamp: 1;
}

.teacher-dialog-mentor-layout .teacher-dialog-composer {
  padding: 10px 14px 12px;
  background: #fff;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.teacher-dialog-mentor-layout .teacher-dialog-composer .community-chat-input-row {
  align-items: flex-end;
  gap: 10px;
}

.teacher-dialog-mentor-layout .teacher-dialog-composer textarea,
.teacher-dialog-mentor-layout .teacher-dialog-composer .messenger-composer-textarea {
  min-height: 52px;
  max-height: 200px;
  border-radius: 22px;
  background: #f0f2f5;
  border: 1px solid transparent;
  padding: 11px 16px;
  overflow-y: hidden;
  line-height: 1.45;
  box-sizing: border-box;
  field-sizing: content;
}

.teacher-dialog-mentor-layout .teacher-dialog-composer .btn {
  border-radius: 999px;
  min-height: 48px;
  padding: 10px 16px;
  font-size: 14px;
}

.teacher-dialog-student-layout .teacher-dialog-page-chat {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-author {
  font-weight: 700;
}

@media (max-width: 900px) {
  .teacher-dialog-card {
    height: min(calc(100vh - 200px), 760px);
    max-height: min(calc(100vh - 200px), 760px);
  }

  body[data-active="teacherDialog"] .teacher-dialog-card {
    height: auto;
    max-height: none;
  }

  .teacher-dialog-spaces-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .teacher-dialog-spaces-bar {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 100%;
  }

  .teacher-dialog-spaces-bar.has-active-topic .teacher-dialog-space-card {
    flex: 0 0 min(190px, 42vw);
  }

  .teacher-dialog-spaces-bar.has-active-topic .teacher-dialog-space-topic-card {
    flex: 0 0 min(320px, 72vw);
  }

  .teacher-dialog-messenger-toolbar {
    flex: 1 1 auto;
    width: 100%;
    justify-content: flex-end;
  }

  .teacher-dialog-space-card {
    flex: 0 0 min(280px, 78vw);
  }

  .teacher-dialog-space-card.has-mentor-context {
    flex: 0 0 min(420px, 92vw);
  }

  .teacher-dialog-workspace.has-community-drawer,
  .teacher-dialog-workspace.is-community-rail-only,
  .teacher-dialog-workspace.is-mentor-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-sidebar,
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .mentor-list-sidebar {
    display: none;
  }

  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-chat-pane,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-empty-state,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-page-chat,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .messenger-empty-chat {
    display: none;
  }

  .teacher-dialog-workspace.is-mentor-list.teacher-private-layout.has-student-list,
  .teacher-dialog-workspace.has-community-drawer.teacher-private-layout.has-student-list,
  .teacher-dialog-workspace.is-community-rail-only.teacher-private-layout.has-student-list {
    grid-template-columns: 1fr;
  }

  .teacher-dialog-sidebar {
    grid-template-columns: 56px minmax(0, 1fr);
    max-height: min(100vh - 180px, 760px);
  }

  .teacher-dialog-sidebar.drawer-panel .teacher-dialog-sidebar-body {
    position: relative;
  }

  .teacher-dialog-sidebar.drawer-panel .teacher-dialog-side-drawer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, calc(100vw - 72px));
    z-index: 95;
    border-radius: 0 12px 12px 0;
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  }

  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-sidebar,
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .mentor-list-sidebar {
    display: none;
  }

  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-chat-pane,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-empty-state,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .teacher-dialog-page-chat,
  .teacher-dialog-workspace.has-student-list:not(.mobile-chat-open) .messenger-empty-chat {
    display: none;
  }

  .teacher-dialog-workspace .messenger-back-btn {
    display: inline-flex;
  }

  .teacher-dialog-workspace .teacher-dialog-topic-mobile-bar {
    display: flex;
  }

  .teacher-dialog-mentor-layout .messenger-back-btn {
    display: inline-flex;
  }
}

@media (min-width: 901px) {
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-sidebar,
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .mentor-list-sidebar {
    display: grid;
  }

  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-chat-pane,
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-empty-state,
  .teacher-dialog-workspace.has-student-list.mobile-chat-open .teacher-dialog-page-chat {
    display: flex;
  }

  .teacher-dialog-workspace.has-student-list .messenger-back-btn {
    display: none;
  }
}

body[data-theme="dark"] .teacher-dialog-card,
body[data-theme="dark"] .teacher-dialog-spaces-row,
body[data-theme="dark"] .teacher-dialog-spaces-bar,
body[data-theme="dark"] .teacher-dialog-space-card,
body[data-theme="dark"] .teacher-dialog-sidebar.mentor-list-sidebar {
  background: #141c18;
  border-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-space-card:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .teacher-dialog-space-card.active {
  background: rgba(134, 239, 172, 0.07);
  border-color: rgba(134, 239, 172, 0.32);
}

body[data-theme="dark"] .teacher-dialog-space-topic-card {
  background: rgba(134, 239, 172, 0.07);
  border-color: rgba(134, 239, 172, 0.32);
}

body[data-theme="dark"] .teacher-dialog-space-topic-title {
  color: #eaf3ec;
}

body[data-theme="dark"] .teacher-dialog-space-topic-meta {
  color: #9fb0a4;
}

body[data-theme="dark"] .teacher-dialog-topic-mobile-bar {
  background: #141c18;
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-space-card.has-mentor-context .teacher-dialog-space-mentor-info {
  border-left-color: #2f4236;
}

body[data-theme="dark"] .teacher-dialog-mentor-layout.teacher-private-layout.has-student-list {
  border-color: #2a3a30;
  background: #101816;
}

body[data-theme="dark"] .teacher-dialog-sidebar {
  border-right-color: #2a3a30;
  background: #141c18;
}

body[data-theme="dark"] .teacher-dialog-nav-rail,
body[data-theme="dark"] .teacher-dialog-folders-rail {
  border-right-color: #2a3a30;
  background: #101816;
}

body[data-theme="dark"] .teacher-dialog-nav-tab.active-tab,
body[data-theme="dark"] .messenger-side-tab.active-tab {
  background: #1a2a20;
  box-shadow: inset 0 0 0 1px rgba(120, 210, 140, 0.2);
}

body[data-theme="dark"] .teacher-dialog-side-drawer,
body[data-theme="dark"] .messenger-side-drawer {
  background: #141c18;
  border-color: #2a3a30;
}

body[data-theme="dark"] .messenger-drawer-search {
  background: #1a2420;
  border-color: #2f4236;
  color: #e8ede9;
}

body[data-theme="dark"] .community-topics-search-expandable {
  background: #1a2420;
  border-color: #2f4236;
}

body[data-theme="dark"] .community-topics-search-expandable:hover,
body[data-theme="dark"] .community-topics-search-expandable:focus-within,
body[data-theme="dark"] .community-topics-search-expandable.is-open {
  border-color: rgba(134, 239, 172, 0.32);
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.08);
}

body[data-theme="dark"] .community-topics-search-icon {
  color: #9fb0a4;
}

body[data-theme="dark"] .community-topics-search-input {
  color: #e8ede9;
}

body[data-theme="dark"] .teacher-dialog-folder-rail:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .teacher-dialog-folder-rail.active {
  background: #1a2620;
  box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.18);
}

body[data-theme="dark"] .teacher-dialog-folder-rail-icon {
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="dark"] .teacher-dialog-chats-pane,
body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-chat-pane,
body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-empty-state {
  background: #141c18;
}

body[data-theme="dark"] .teacher-dialog-chats-toolbar {
  background: #141c18;
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-chats-search {
  background-color: #1a2620;
  color: #eaf3ec;
}

body[data-theme="dark"] .teacher-dialog-chat-row:hover:not(.active) {
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme="dark"] .teacher-dialog-chat-row.active {
  background: rgba(134, 239, 172, 0.1);
}

body[data-theme="dark"] .teacher-dialog-list-group-head {
  background: #101816;
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-tg-head,
body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-composer {
  background: #141c18;
  border-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-composer textarea {
  background: #1a2620;
  color: #eaf3ec;
}

body[data-theme="dark"] .teacher-dialog-mentor-layout .teacher-dialog-pinned {
  background: rgba(20, 28, 24, 0.96);
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-spaces-list {
  background: #141c18;
  border-bottom-color: #2a3a30;
}

body[data-theme="dark"] .teacher-dialog-space-row {
  background: #1a2420;
  border-color: #2f4236;
  color: #e8ede9;
}

body[data-theme="dark"] .teacher-dialog-space-row:hover:not(.active) {
  background: #1f2b26;
}

body[data-theme="dark"] .teacher-dialog-space-row.active {
  background: #1a2a20;
  border-color: rgba(134, 239, 172, 0.32);
}

body[data-theme="dark"] .teacher-dialog-space-body strong {
  color: #eef4ef;
}

body[data-theme="dark"] .teacher-dialog-space-body .muted {
  color: #b8c5bb;
}

body[data-theme="dark"] .teacher-dialog-space-hint {
  background: #101816;
}

body[data-theme="dark"] .teacher-dialog-space-hint .muted {
  color: #b8c5bb;
}

body[data-theme="dark"] .teacher-dialog-chats-section {
  background: #141c18;
}

.community-categories-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1750;
  display: flex;
  justify-content: flex-start;
  background: rgba(15, 23, 42, 0.32);
}

.community-categories-mobile-drawer {
  width: min(320px, 92vw);
  height: 100vh;
  overflow: auto;
  padding: 16px 18px 24px;
  background: var(--panel);
  box-shadow: 16px 0 40px rgba(15, 23, 42, 0.2);
  animation: communityCategoriesSlideIn 0.22s ease;
}

@keyframes communityCategoriesSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.community-main-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.community-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: inherit;
  max-height: inherit;
  padding: 0;
  overflow: hidden;
  background: var(--messenger-chat-wallpaper-base);
  box-shadow: var(--shadow);
}

.community-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.community-chat-header h2 {
  margin: 6px 0 4px;
  font-size: 18px;
  line-height: 1.35;
}

.community-chat-header-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.community-chat-header-tools {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.community-chat-feed {
  flex: 1;
  overflow: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.community-chat-message {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.community-chat-feed .community-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: min(85%, 640px);
}

.community-chat-avatar-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}

.community-chat-avatar-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.community-chat-bubble {
  position: relative;
  background: #fff;
  border: 1px solid #e4ebe5;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: none;
}

.community-chat-feed .community-chat-bubble {
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.community-chat-feed .community-chat-message:hover .community-chat-bubble,
.community-chat-feed .community-chat-message:focus-within .community-chat-bubble {
  transform: translateY(-1px);
  border-color: rgba(36, 115, 56, 0.34);
  background: #fefefe;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.community-chat-feed .community-chat-message.from-teacher:hover .community-chat-bubble,
.community-chat-feed .community-chat-message.from-teacher:focus-within .community-chat-bubble {
  background: #f3fcf4;
  border-color: rgba(36, 115, 56, 0.44);
}

.community-chat-feed .community-chat-message.is-important:hover .community-chat-bubble,
.community-chat-feed .community-chat-message.is-important:focus-within .community-chat-bubble {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(214, 168, 40, 0.3);
}

.community-chat-feed .community-chat-message.highlighted:hover .community-chat-bubble,
.community-chat-feed .community-chat-message.highlighted:focus-within .community-chat-bubble {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08), 0 0 0 2px rgba(36, 115, 56, 0.35);
}

.community-chat-feed .community-chat-message.is-deleted:hover .community-chat-bubble,
.community-chat-feed .community-chat-message.is-deleted:focus-within .community-chat-bubble {
  background: #f8f9f8;
  border-color: rgba(36, 115, 56, 0.22);
}

.community-chat-feed .community-chat-message:hover .community-chat-quote,
.community-chat-feed .community-chat-message:focus-within .community-chat-quote {
  background: #f2f8f2;
}

.community-chat-feed .community-chat-message:hover .community-chat-quote p,
.community-chat-feed .community-chat-message:focus-within .community-chat-quote p,
.community-chat-feed .community-chat-message:hover .community-chat-quote span,
.community-chat-feed .community-chat-message:focus-within .community-chat-quote span {
  color: inherit;
  opacity: 1;
}

.community-chat-message.from-teacher .community-chat-bubble {
  background: #effaf0;
  border-color: #b9dcc0;
}

.community-chat-message.highlighted .community-chat-bubble {
  box-shadow: 0 0 0 2px rgba(36, 115, 56, 0.35);
  animation: communityHighlightPulse 1.2s ease 2;
}

@keyframes communityHighlightPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(36, 115, 56, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(36, 115, 56, 0.2); }
}

.community-chat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.community-chat-author {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.community-chat-author:hover {
  color: var(--accent);
}

.community-chat-role {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ee;
  color: #5a6460;
}

.community-chat-role.teacher {
  background: rgba(36, 115, 56, .12);
  color: var(--accent);
}

.community-chat-role.admin {
  background: rgba(99, 71, 169, .14);
  color: #6347a9;
}

.community-chat-meta time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.community-message-important-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(214, 168, 40, 0.16);
  color: #8a6400;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.community-message-menu-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: 2px;
}

.community-message-menu-stack.is-portal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.community-message-reaction-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08);
}

.community-message-reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.community-message-reaction-btn:hover,
.community-message-reaction-btn:focus-visible {
  background: rgba(36, 115, 56, 0.1);
  transform: scale(1.08);
  outline: none;
}

.community-message-menu-stack .community-message-menu {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  min-width: 196px;
}

.community-message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.community-message-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.community-message-reaction-chip:hover,
.community-message-reaction-chip:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.community-message-reaction-chip.is-mine {
  border-color: rgba(36, 115, 56, 0.42);
  background: rgba(36, 115, 56, 0.12);
}

.community-message-reaction-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.community-message-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 1px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.community-chat-feed .community-chat-message:hover .community-message-menu-btn,
.community-chat-feed .community-message-menu-wrap:focus-within .community-message-menu-btn {
  transform: scale(1.04);
}

.community-chat-message:hover .community-message-menu-btn,
.community-message-menu-wrap:focus-within .community-message-menu-btn,
.community-message-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.community-message-menu-btn:hover,
.community-message-menu-btn:focus-visible {
  background: #edf3ee;
  color: var(--ink);
}

.community-chat-feed .community-message-menu-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.community-message-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 196px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08);
  z-index: 90;
}

.community-message-menu.opens-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.community-message-menu.is-portal,
.community-message-menu-stack.is-portal,
#community-message-menu-portal,
#teacher-dialog-message-menu-portal,
#group-chat-message-menu-portal,
#student-appeal-message-menu-portal {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  margin: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.community-message-menu.is-portal.opens-up {
  top: auto;
  bottom: auto;
}

.community-message-menu-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 10px;
  cursor: pointer;
}

.community-message-menu-item:hover,
.community-message-menu-item:focus-visible {
  background: var(--soft-green);
  outline: none;
}

.community-message-menu-item.danger {
  color: #b42318;
}

.community-message-menu-item.danger:hover,
.community-message-menu-item.danger:focus-visible {
  background: #fff1f0;
  color: #9f1d13;
}

.community-chat-message.is-important .community-chat-bubble {
  box-shadow: inset 0 0 0 1px rgba(214, 168, 40, 0.28);
}

.community-chat-text.deleted {
  color: var(--muted);
  font-style: italic;
}

.community-message-edit {
  display: grid;
  gap: 8px;
}

.community-message-edit-input {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  color: var(--ink);
  background: #fff;
}

.community-message-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.community-message-delete-confirm {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #f2d4d2;
  background: #fff7f6;
}

.community-message-delete-confirm p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink);
}

.community-message-delete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.community-chat-quote {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent-border);
  border-radius: 6px;
  background: #f7faf7;
}

.community-chat-quote span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.community-chat-quote p {
  margin: 0;
  font-size: 13px;
  color: #4d5852;
  line-height: 1.4;
}

.community-chat-text {
  margin: 0;
  line-height: 1.55;
  color: #2f3833;
  word-break: break-word;
  opacity: 1;
}

.community-chat-bubble,
.community-chat-message {
  opacity: 1;
}

.community-chat-message:hover .community-chat-text,
.community-chat-message:focus-within .community-chat-text,
.community-chat-bubble:has(.community-message-menu-btn[aria-expanded="true"]) .community-chat-text {
  color: #2f3833;
  opacity: 1;
}

.community-chat-actions {
  margin-top: 6px;
}

.community-reply-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.community-reply-btn:hover {
  text-decoration: underline;
}

.community-chat-composer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px 18px 16px;
  flex-shrink: 0;
}

.community-reply-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5faf6;
  border: 1px solid #dbe8de;
}

.community-reply-bar p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.community-chat-input-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.community-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf8;
  color: #2f4a38;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.community-attach-btn span {
  pointer-events: none;
}

.community-attach-btn:hover,
.community-attach-btn:focus-visible {
  background: #edf6ef;
  border-color: rgba(36, 115, 56, 0.45);
  outline: none;
}

.community-compose-attachments {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.community-compose-attachment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.community-compose-attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.community-compose-attachment-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #edf3ef;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  color: #3a5244;
}

.community-compose-attachment-meta {
  min-width: 0;
}

.community-compose-attachment-meta strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-compose-attachment-meta span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.community-compose-attachment-remove {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.community-compose-attachment-remove:hover {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.35);
  background: #fff5f4;
}

.community-message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.community-message-attachment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.community-message-attachment.image {
  grid-template-columns: auto minmax(0, 1fr);
}

.community-message-attachment-image-link img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.community-message-attachment-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #edf3ef;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  color: #3a5244;
}

.community-message-attachment-meta strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-message-attachment-meta span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.community-message-attachment-open {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.community-message-attachment-open:hover {
  text-decoration: underline;
}

.community-chat-input-row textarea,
.messenger-composer-textarea {
  min-height: 52px;
  max-height: 200px;
  resize: none;
  overflow-y: hidden;
  overflow-x: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.45;
  box-sizing: border-box;
  field-sizing: content;
}

.community-chat-composer-actions {
  margin-top: 8px;
}

.community-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.32);
  cursor: pointer;
}

.community-profile-drawer {
  position: relative;
  width: min(400px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 18px 22px 24px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.24);
  cursor: default;
  animation: communityProfileSlideIn .22s ease;
}

@keyframes communityProfileSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.community-profile-drawer .drawer-close {
  margin-bottom: 8px;
}

.community-profile-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.community-profile-actions {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.community-profile-hero {
  text-align: center;
  margin-bottom: 14px;
}

.community-profile-hero h3 {
  margin: 10px 0 6px;
}

.community-profile-role {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.community-profile-role.teacher {
  background: rgba(46, 120, 214, .12);
  color: var(--blue);
}

.community-profile-stats {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 10px;
  background: #f7faf7;
  border: 1px solid #e4ebe5;
}

.community-profile-stats > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.community-profile-stats span {
  color: var(--muted);
}

.community-profile-about {
  margin-bottom: 16px;
}

.community-profile-about h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.community-profile-about p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
}

.community-member-about {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.community-profile-replies h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.community-profile-reply-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.community-profile-reply-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.community-profile-reply-row small {
  color: var(--muted);
  font-size: 12px;
}

.community-member-row.action-row {
  cursor: pointer;
  border: 0;
  width: 100%;
  text-align: left;
  background: transparent;
}

.community-member-row.action-row:hover {
  background: var(--soft-green);
}

body[data-theme="dark"] .community-members-modal,
body[data-theme="dark"] .community-members-search {
  background: #141f19;
  border-color: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="dark"] .community-members-header,
body[data-theme="dark"] .community-members-controls,
body[data-theme="dark"] .community-members-footer {
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .community-member-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .community-member-card:hover {
  background: rgba(36, 115, 56, 0.12);
  border-color: rgba(120, 210, 140, 0.28);
}

body[data-theme="dark"] .community-member-meta-item b,
body[data-theme="dark"] .community-member-name {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-members-empty {
  color: #eaf3ec;
}

@media (max-width: 1280px) {
  .community-layout.no-chat {
    grid-template-columns: 56px 56px minmax(0, 1fr);
  }

  .community-layout.has-chat {
    grid-template-columns: 56px 56px minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .community-layout.no-chat {
    grid-template-columns: 56px 56px minmax(0, 1fr);
    grid-template-areas: "rail topics main";
  }

  .community-layout.has-chat {
    grid-template-columns: 56px 56px minmax(0, 1fr);
    grid-template-areas: "rail topics chat";
  }

  .community-categories-shell { grid-area: rail; }
  .community-topics-shell,
  .community-topics-expanded { grid-area: topics; }
  .community-main-placeholder { grid-area: main; }
  .community-chat-main,
  .community-chat-placeholder { grid-area: chat; }
}

@media (max-width: 820px) {
  .community-categories-mobile-btn {
    display: inline-flex;
  }

  .community-topics-mobile-btn {
    display: inline-flex;
  }

  .community-categories-shell {
    display: none;
  }

  .community-topics-shell {
    display: none;
  }

  .community-layout.no-chat {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }

  .community-layout.has-chat {
    grid-template-columns: 1fr;
    grid-template-areas: "chat";
  }

  .community-main-placeholder {
    grid-area: main;
    min-height: min(56vh, 520px);
  }

  .community-topics-expanded {
    grid-area: topics;
    max-height: none;
  }

  .community-layout.no-chat .community-topics-expanded {
    min-height: min(56vh, 520px);
    max-height: none;
  }

  .community-layout.has-chat .community-topics-expanded {
    display: none;
  }

  .community-chat-main {
    grid-area: chat;
    min-height: 56vh;
  }

  .community-profile-drawer {
    width: 100vw;
    padding: 16px 18px 22px;
  }
}

@media (max-width: 720px) {
  .community-discussions-head {
    flex-direction: column;
    align-items: stretch;
  }

  .community-sort-select {
    width: 100%;
  }

  .community-topic-item {
    grid-template-columns: 1fr;
  }

  .community-topic-actions {
    flex-direction: row;
    padding: 0 12px 10px 14px;
  }

  .community-chat-input-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .community-chat-input-row .btn {
    grid-column: 1 / -1;
  }

  .community-chat-meta time {
    margin-left: 0;
    width: 100%;
  }
}

body[data-theme="dark"] .community-chat-panel {
  background: var(--messenger-chat-wallpaper-base);
}

body[data-theme="dark"] .community-chat-placeholder {
  background: #0f1712;
}

body[data-theme="dark"] .community-chat-header,
body[data-theme="dark"] .community-chat-composer {
  background: #141f19;
  border-color: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="dark"] .community-chat-header h2 {
  color: #ffffff;
}

body[data-theme="dark"] .community-chat-header .muted,
body[data-theme="dark"] .community-chat-header p {
  color: #9eb5a8;
}

body[data-theme="dark"] .community-chat-feed {
  background-color: var(--messenger-chat-wallpaper-base);
  background-image: var(--messenger-chat-wallpaper-image);
  background-size: var(--messenger-chat-wallpaper-size);
  background-position: 0 0;
  background-repeat: repeat;
}

body[data-theme="dark"] .community-chat-bubble {
  background: #162b21;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-chat-message.from-teacher .community-chat-bubble {
  background: #1a3328;
  border-color: rgba(72, 160, 108, 0.42);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message:hover .community-chat-bubble,
body[data-theme="dark"] .community-chat-feed .community-chat-message:focus-within .community-chat-bubble {
  background: #1c382c;
  border-color: rgba(88, 185, 108, 0.38);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.from-teacher:hover .community-chat-bubble,
body[data-theme="dark"] .community-chat-feed .community-chat-message.from-teacher:focus-within .community-chat-bubble {
  background: #1f3f31;
  border-color: rgba(88, 185, 108, 0.48);
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-deleted:hover .community-chat-bubble,
body[data-theme="dark"] .community-chat-feed .community-chat-message.is-deleted:focus-within .community-chat-bubble {
  background: #172820;
  border-color: rgba(88, 185, 108, 0.24);
}

body[data-theme="dark"] .community-chat-feed .community-chat-message:hover .community-chat-quote,
body[data-theme="dark"] .community-chat-feed .community-chat-message:focus-within .community-chat-quote {
  background: #14261d;
}

body[data-theme="dark"] .community-chat-feed .community-message-menu-btn:focus-visible {
  outline-color: #86efac;
}

body[data-theme="dark"] .community-chat-author {
  color: #ffffff;
}

body[data-theme="dark"] .community-chat-author:hover {
  color: #b8efc3;
}

body[data-theme="dark"] .community-message-menu {
  background: #18231c;
  border-color: #2a3a30;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42), 0 4px 12px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .community-message-menu-item {
  color: #eaf3ec;
}

body[data-theme="dark"] .community-message-menu-item:hover,
body[data-theme="dark"] .community-message-menu-item:focus-visible {
  background: rgba(36, 115, 56, 0.16);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-message-menu-item.danger {
  color: #ff8f84;
}

body[data-theme="dark"] .community-message-menu-item.danger:hover,
body[data-theme="dark"] .community-message-menu-item.danger:focus-visible {
  background: rgba(180, 35, 24, 0.18);
  color: #ffc8c2;
}

body[data-theme="dark"] .community-message-reaction-bar {
  background: #1a2420;
  border-color: #2f4236;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34), 0 4px 12px rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .community-message-reaction-btn:hover,
body[data-theme="dark"] .community-message-reaction-btn:focus-visible {
  background: rgba(134, 239, 172, 0.12);
}

body[data-theme="dark"] .community-message-reaction-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: #2f4236;
}

body[data-theme="dark"] .community-message-reaction-chip.is-mine {
  background: rgba(134, 239, 172, 0.14);
  border-color: rgba(134, 239, 172, 0.34);
}

body[data-theme="dark"] .community-message-reaction-count {
  color: #b8c5bb;
}

body[data-theme="dark"] .community-message-menu-btn:hover,
body[data-theme="dark"] .community-message-menu-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-message-important-badge {
  background: rgba(214, 168, 40, 0.2);
  color: #f0d27a;
}

body[data-theme="dark"] .community-message-edit-input {
  background: #121a15;
  border-color: #2a3a30;
  color: #f2f7f3;
}

body[data-theme="dark"] .community-message-delete-confirm {
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(255, 143, 132, 0.24);
}

body[data-theme="dark"] .community-chat-text.deleted {
  color: #9eb5a8;
  opacity: 1;
}

body[data-theme="dark"] .community-chat-text,
body[data-theme="dark"] .community-chat-message .community-chat-text,
body[data-theme="dark"] .community-chat-message:hover .community-chat-text,
body[data-theme="dark"] .community-chat-message:focus-within .community-chat-text,
body[data-theme="dark"] .community-chat-bubble .community-chat-text,
body[data-theme="dark"] .community-chat-message.from-teacher .community-chat-text,
body[data-theme="dark"] .community-chat-message.from-student .community-chat-text {
  color: #f2f7f3;
  opacity: 1;
}

body[data-theme="dark"] .community-chat-meta time {
  color: #9eb5a8;
  opacity: 1;
}

body[data-theme="dark"] .community-chat-role {
  background: rgba(255, 255, 255, 0.08);
  color: #c5d4cb;
}

body[data-theme="dark"] .community-chat-role.teacher {
  background: rgba(72, 160, 108, 0.22);
  color: #b8efc3;
}

body[data-theme="dark"] .community-chat-role.admin {
  background: rgba(147, 112, 219, 0.24);
  color: #d4c4f5;
}

body[data-theme="dark"] .community-chat-quote {
  background: #0f2219;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(72, 160, 108, 0.55);
}

body[data-theme="dark"] .community-chat-quote span {
  color: rgba(234, 243, 236, 0.78);
  opacity: 1;
}

body[data-theme="dark"] .community-chat-quote p {
  color: rgba(234, 243, 236, 0.9);
  opacity: 1;
}

body[data-theme="dark"] .community-reply-btn {
  color: #8fd9a0;
}

body[data-theme="dark"] .community-reply-btn:hover {
  color: #b8efc3;
}

body[data-theme="dark"] .community-reply-bar {
  background: #13261d;
  border-color: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="dark"] .community-reply-bar strong {
  color: #eaf3ec;
}

body[data-theme="dark"] .community-reply-bar p {
  color: #a8b8ad;
}

body[data-theme="dark"] .community-chat-input-row textarea {
  background: #121c17;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-chat-input-row textarea::placeholder {
  color: #7f9488;
}

body[data-theme="dark"] .community-chat-composer-actions .btn.secondary {
  color: #b8efc3;
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .community-attach-btn {
  background: #162b21;
  border-color: rgba(255, 255, 255, 0.14);
  color: #d8f0dc;
}

body[data-theme="dark"] .community-attach-btn:hover,
body[data-theme="dark"] .community-attach-btn:focus-visible {
  background: #1a3328;
  border-color: rgba(88, 185, 108, 0.38);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-compose-attachment,
body[data-theme="dark"] .community-message-attachment {
  background: #162b21;
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .community-compose-attachment-icon,
body[data-theme="dark"] .community-message-attachment-icon {
  background: #1a3328;
  border-color: rgba(255, 255, 255, 0.1);
  color: #d8f0dc;
}

body[data-theme="dark"] .community-compose-attachment-meta strong,
body[data-theme="dark"] .community-message-attachment-meta strong {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-compose-attachment-meta span,
body[data-theme="dark"] .community-message-attachment-meta span {
  color: rgba(255, 255, 255, 0.68);
}

body[data-theme="dark"] .community-compose-attachment-remove {
  background: #13261d;
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
}

body[data-theme="dark"] .community-compose-attachment-remove:hover {
  background: rgba(192, 57, 43, 0.16);
  border-color: rgba(255, 130, 130, 0.35);
  color: #ffb4b4;
}

body[data-theme="dark"] .community-message-attachment-open {
  color: #8ee09d;
}

body[data-theme="dark"] .community-message-attachment-image-link img {
  border-color: rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .community-topic-item,
body[data-theme="dark"] .community-sort-select {
  background: #18231c;
  border-color: #2a3a30;
}
body[data-theme="dark"] .community-profile-stats,
body[data-theme="dark"] .community-sidebar-wrap .right-rail .panel {
  background: #152019;
  border-color: #2a3a30;
}

body[data-theme="dark"] .community-profile-drawer,
body[data-theme="dark"] .community-profile-reply-row,
body[data-theme="dark"] .community-categories-tab,
body[data-theme="dark"] .community-toolbar-search,
body[data-theme="dark"] .community-categories-drawer,
body[data-theme="dark"] .community-topics-tab,
body[data-theme="dark"] .community-topics-drawer,
body[data-theme="dark"] .community-topics-drawer-floating,
body[data-theme="dark"] .community-topics-mobile-drawer {
  background: #18231c;
  border-color: #2a3a30;
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.42),
    0 8px 20px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .community-topic-item:hover {
  border-color: rgba(72, 160, 108, 0.42);
  background: #1c2a22;
}

body[data-theme="dark"] .community-topic-open:hover {
  background: rgba(36, 115, 56, 0.1);
}

body[data-theme="dark"] .community-topic-item.active {
  background: #1a2a20;
}

body[data-theme="dark"] .community-topic-item.active .community-topic-open:hover {
  background: transparent;
}

body[data-theme="dark"] .community-topic-excerpt,
body[data-theme="dark"] .community-topic-activity {
  color: #9eb5a8;
}

body[data-theme="dark"] .community-topic-last-message {
  background: rgba(36, 115, 56, 0.12);
  border-color: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="dark"] .community-topic-last-author {
  color: #8fd9a0;
}

body[data-theme="dark"] .community-topic-meta span {
  color: #eaf3ec;
}

body[data-theme="dark"] .community-topic-attachment-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #b8c5bb;
}

body[data-theme="dark"] .community-topic-open h3 {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-discussions-hint {
  background: rgba(36, 115, 56, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .community-discussions-hint strong {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-discussions-hint p {
  color: #b8c5bb;
}

body[data-theme="dark"] .community-general-chat-sidecard {
  background: rgba(36, 115, 56, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .community-general-chat-sidecard.is-active {
  border-color: rgba(120, 210, 140, 0.28);
  box-shadow: inset 3px 0 0 rgba(120, 210, 140, 0.65);
}

body[data-theme="dark"] .community-general-chat-sidecard strong {
  color: #f2f7f3;
}

body[data-theme="dark"] .community-general-chat-sidecard p {
  color: #b8c5bb;
}

body[data-theme="dark"] .community-topic-search-hit {
  background: rgba(36, 115, 56, 0.1);
  border-color: rgba(255, 255, 255, 0.08);
  color: #eaf3ec;
}

body[data-theme="dark"] .community-search-mark {
  background: rgba(120, 210, 140, 0.22);
  color: #f2f7f3;
}

body[data-theme="dark"] .community-search-count {
  background: rgba(36, 115, 56, 0.22);
  color: #b8efc3;
}

/* Step 135: support ticket drawer dark readability */
body[data-theme="dark"] .ticket-drawer {
  background: #17221d;
  color: #f2f7f3;
  opacity: 1;
}

body[data-theme="dark"] .ticket-drawer-overlay {
  z-index: 1800;
}

body[data-theme="dark"] .ticket-drawer {
  z-index: 1900;
}

body[data-theme="dark"] .ticket-drawer .drawer-close {
  background: #162b21;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f2f7f3;
}

body[data-theme="dark"] .ticket-drawer .ticket-detail h2 {
  color: #f2f7f3;
}

body[data-theme="dark"] .ticket-drawer .ticket-detail .section-title p,
body[data-theme="dark"] .ticket-drawer .ticket-detail .muted {
  color: rgba(255, 255, 255, 0.68);
}

body[data-theme="dark"] .ticket-drawer .ticket-detail-summary > span {
  background: #162b21 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #eaf3ec !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .ticket-drawer .ticket-detail-summary > span > b {
  color: rgba(255, 255, 255, 0.68) !important;
  font-weight: 700;
}

body[data-theme="dark"] .ticket-drawer .ticket-detail-summary > span > small {
  color: rgba(255, 255, 255, 0.55) !important;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar {
  background: #13261d !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar label {
  color: rgba(255, 255, 255, 0.68) !important;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #162b21 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f2f7f3 !important;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar select::-ms-expand {
  display: none;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar select option {
  background: #162b21;
  color: #f2f7f3;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar .btn.secondary {
  background: rgba(88, 185, 108, 0.14) !important;
  border-color: rgba(88, 185, 108, 0.38) !important;
  color: #a9efb4 !important;
}

body[data-theme="dark"] .ticket-drawer .ticket-actions-bar .btn.secondary:hover {
  background: rgba(88, 185, 108, 0.22) !important;
  border-color: rgba(88, 185, 108, 0.48) !important;
  color: #c8f5ce !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble {
  background: #162b21 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble.support {
  background: #1a3328 !important;
  border-color: rgba(88, 185, 108, 0.28) !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble strong {
  color: #ffffff !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble strong span {
  color: rgba(255, 255, 255, 0.68) !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble p {
  color: #f2f7f3 !important;
}

body[data-theme="dark"] .ticket-drawer .message-bubble em {
  color: rgba(255, 255, 255, 0.68) !important;
}

body[data-theme="dark"] .ticket-drawer .field label {
  color: #eaf3ec !important;
}

body[data-theme="dark"] .ticket-drawer .field textarea {
  background: #162b21 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f2f7f3 !important;
}

body[data-theme="dark"] .ticket-drawer .field textarea::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}

body[data-theme="dark"] .ticket-drawer .btn:not(.secondary):not(.ghost) {
  background: linear-gradient(180deg, #3d9a57 0%, #247338 100%);
  border-color: rgba(88, 185, 108, 0.45);
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

body[data-theme="dark"] .ticket-drawer .btn:not(.secondary):not(.ghost):hover {
  background: linear-gradient(180deg, #47a861 0%, #2a8042 100%);
}

body[data-theme="dark"] .ticket-drawer .notice {
  background: rgba(88, 185, 108, 0.1);
  border: 1px solid rgba(88, 185, 108, 0.24);
  color: #d8f0dc;
}

body[data-theme="dark"] .ticket-drawer .ticket-attachments h3 {
  color: #f2f7f3;
}

body[data-theme="dark"] .nickname-input-wrap {
  background: #162b21;
  border-color: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .nickname-input-wrap input {
  background: transparent;
  color: #f2f7f3;
}

body[data-theme="dark"] .community-member-nickname,
body[data-theme="dark"] .community-profile-nickname,
body[data-theme="dark"] .community-mention {
  color: #7fd99a;
}

/* Step 189: sidebar nav always clickable above main content */
.shell > .sidebar {
  z-index: 120;
  pointer-events: auto;
  isolation: isolate;
}

.shell > .sidebar .brand,
.shell > .sidebar .role-switch {
  pointer-events: none;
}

.shell > .sidebar .menu {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.shell > .sidebar .menu button,
.shell > .sidebar .sidebar-logout {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  cursor: pointer;
}

.shell > .sidebar .menu button:disabled {
  pointer-events: none;
  cursor: not-allowed;
}

.shell > .main {
  position: relative;
  z-index: 1;
}

.shell > .watermark {
  pointer-events: none;
}

@media (min-width: 1101px) {
  .shell > .sidebar {
    z-index: 120;
  }

  .shell > .main {
    margin-left: 240px;
    width: calc(100% - 240px);
    max-width: calc(100% - 240px);
  }

  .shell.compact-sidebar > .main {
    margin-left: 88px;
    width: calc(100% - 88px);
    max-width: calc(100% - 88px);
  }
}

@media (max-width: 1100px) {
  .shell > .sidebar {
    z-index: 120;
    pointer-events: auto;
  }

  .shell > .sidebar.open {
    pointer-events: auto;
  }
}

/* Messenger v2 */
.messenger-v2-page {
  height: calc(100dvh - 148px);
  min-height: 520px;
}

.messenger-v2-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
}

.messenger-v2-sidebar,
.messenger-v2-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.messenger-v2-sidebar-head {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

.messenger-v2-sidebar-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.messenger-v2-channel-list {
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.messenger-v2-channel {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
}

.messenger-v2-channel:hover,
.messenger-v2-channel.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}

.messenger-v2-channel-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-size: 1rem;
}

.messenger-v2-channel-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.messenger-v2-channel-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.messenger-v2-channel-top strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messenger-v2-channel-top time {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.messenger-v2-channel-preview {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messenger-v2-unread {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

.messenger-v2-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.messenger-v2-chat-head strong {
  display: block;
}

.messenger-v2-back {
  display: none;
}

.messenger-v2-feed {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--messenger-chat-wallpaper-base, #dce8e2);
  background-image: var(--messenger-chat-wallpaper-image, none);
  background-size: var(--messenger-chat-wallpaper-size, auto);
}

.messenger-v2-message {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 640px);
}

.messenger-v2-message.is-own {
  align-self: flex-end;
  align-items: flex-end;
}

.messenger-v2-message.is-other {
  align-self: flex-start;
  align-items: flex-start;
}

.messenger-v2-message-author {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.messenger-v2-message-bubble {
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.messenger-v2-message.is-own .messenger-v2-message-bubble {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.messenger-v2-message-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.messenger-v2-message-bubble time {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.messenger-v2-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  align-items: end;
}

.messenger-v2-chat-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
}

.messenger-v2-error {
  margin: 0;
  padding: 8px 16px;
  color: #b42318;
  background: #fef3f2;
}

body[data-theme="dark"] .messenger-v2-error {
  color: #fda29b;
  background: rgba(180, 35, 24, 0.18);
}

.messenger-v2-loading,
.messenger-v2-empty-feed,
.messenger-v2-empty-list {
  padding: 12px;
}

@media (max-width: 900px) {
  .messenger-v2-page {
    height: calc(100dvh - 120px);
  }

  .messenger-v2-layout {
    grid-template-columns: 1fr;
  }

  .messenger-v2-sidebar.mobile-hidden,
  .messenger-v2-main.mobile-hidden {
    display: none;
  }

  .messenger-v2-back {
    display: inline-flex;
  }
}

/* Student homework list and detail */
.student-homework-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.student-homework-tabs .tab-count {
  display: inline-flex;
  min-width: 20px;
  justify-content: center;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(31, 122, 63, .12);
  font-size: 12px;
  font-weight: 700;
}

.student-homework-list {
  display: grid;
  gap: 14px;
}

.student-homework-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid #dfe7e2;
  border-radius: 18px;
  background: #fff;
}

.student-homework-card.is-returned {
  border-color: #f0b429;
  background: linear-gradient(180deg, #fff9eb 0%, #ffffff 100%);
  box-shadow: 0 10px 24px rgba(240, 180, 41, .12);
}

.student-homework-card.is-accepted {
  opacity: .82;
  background: #fafbfa;
}

.student-homework-card-head {
  display: grid;
  gap: 4px;
}

.student-homework-course {
  font-weight: 800;
  color: #1f7a3f;
}

.student-homework-path,
.student-homework-due {
  color: var(--muted);
  font-size: 14px;
}

.student-homework-card h3 {
  margin: 0;
  font-size: 20px;
}

.student-homework-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.student-homework-teacher-comment {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(240, 180, 41, .12);
}

.student-homework-teacher-comment p {
  margin: 6px 0 0;
}

.student-homework-empty {
  padding: 28px 20px;
}

.student-homework-detail-layout .homework-hero.is-returned {
  border-color: #f0b429;
  background: linear-gradient(180deg, #fff9eb 0%, #ffffff 100%);
}

.student-homework-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.student-homework-return-panel {
  border-color: #f0b429;
  background: #fffaf0;
}

.student-homework-prev-answer {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f5f7f6;
}

body[data-theme="dark"] .student-homework-card {
  background: var(--dark-card);
  border-color: var(--dark-border);
}

body[data-theme="dark"] .student-homework-card.is-returned,
body[data-theme="dark"] .student-homework-detail-layout .homework-hero.is-returned,
body[data-theme="dark"] .student-homework-return-panel {
  background: rgba(240, 180, 41, .08);
  border-color: rgba(240, 180, 41, .35);
}

body[data-theme="dark"] .student-homework-prev-answer {
  background: rgba(255, 255, 255, .04);
}

body[data-theme="dark"] .student-homework-teacher-comment {
  background: rgba(240, 180, 41, .1);
}

/* Простая стартовая страница: вход в образовательный продукт вместо большого лендинга */
.simple-landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 54px);
  background:
    radial-gradient(circle at 18% 16%, rgba(64, 166, 83, .28), transparent 34%),
    linear-gradient(120deg, rgba(5, 13, 10, .94), rgba(7, 18, 16, .88)),
    var(--simple-hero) center/cover no-repeat;
  color: #f4fff6;
}

.simple-entry-shell {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  gap: clamp(22px, 4vw, 54px);
  align-items: center;
}

.simple-entry-copy {
  display: grid;
  gap: 18px;
}

.simple-entry-copy .brand {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.simple-entry-label,
.simple-login-brand,
.simple-login-status {
  width: fit-content;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.simple-entry-label {
  color: rgba(186, 244, 196, .92);
}

.simple-entry-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(42px, 8vw, 92px);
  line-height: .92;
  letter-spacing: -.06em;
}

.simple-entry-lead {
  max-width: 720px;
  margin: 0;
  color: rgba(241, 255, 244, .86);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.45;
}

.simple-program-card {
  max-width: 760px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid rgba(190, 241, 200, .22);
  border-radius: 22px;
  background: rgba(255, 255, 255, .08);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .24);
  backdrop-filter: blur(18px);
}

.simple-program-card > span {
  display: block;
  margin-bottom: 14px;
  color: rgba(237, 255, 240, .68);
  font-weight: 800;
}

.simple-program-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
}

.simple-program-list li {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(0, 0, 0, .16);
}

.simple-program-list b {
  color: #fff;
  font-size: 15px;
}

.simple-program-list small {
  color: rgba(235, 250, 238, .68);
  line-height: 1.35;
}

.simple-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.simple-entry-actions .btn.secondary {
  background: #fff;
  color: #1f6f32;
  border-color: rgba(255,255,255,.36);
}

.simple-entry-actions .simple-light-ghost {
  color: #fff;
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.06);
}

.simple-login-card {
  width: 100%;
  padding: clamp(24px, 3.5vw, 34px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: #0b121d;
  color: #fff;
  box-shadow: 0 34px 110px rgba(0, 0, 0, .42);
}

.simple-login-brand {
  margin-bottom: 22px;
  color: #3cff6f;
}

.simple-login-status {
  display: inline-flex;
  margin-bottom: 12px;
  color: rgba(255,255,255,.54);
}

.simple-login-card h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.05;
}

.simple-login-card p {
  margin: 0 0 18px;
  color: rgba(255,255,255,.62);
  line-height: 1.45;
}

.simple-login-card .field label {
  color: rgba(255,255,255,.62);
}

.simple-login-card .field input {
  min-height: 52px;
  background: #eaf2ff;
  color: #111827;
  border-color: transparent;
}

.simple-login-card .btn.full {
  margin-top: 10px;
  width: 100%;
  min-height: 50px;
}

.simple-login-card .login-hints,
.simple-login-note {
  margin: 12px 0 16px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.68);
  font-size: 13px;
  line-height: 1.45;
}

.simple-login-card .login-hints p,
.simple-login-card .login-hints .muted {
  color: rgba(255,255,255,.72);
}

.simple-login-card .login-error {
  margin: 12px 0;
}

.simple-login-ready {
  display: grid;
  gap: 12px;
}

@media (max-width: 860px) {
  .simple-landing {
    align-items: start;
    padding: 18px;
  }
  .simple-entry-shell {
    grid-template-columns: 1fr;
  }
  .simple-program-list {
    grid-template-columns: 1fr;
  }
  .simple-entry-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Zen-style lesson content blocks */
.lesson-zen-editor-section {
  gap: 18px;
}

.lesson-zen-intro {
  padding: 14px 16px;
  border: 1px solid #dfe9e2;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(33, 123, 72, 0.08), rgba(255, 255, 255, 0.95));
}

.lesson-zen-intro h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.lesson-zen-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dfe9e2;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.lesson-zen-feed {
  display: grid;
  gap: 14px;
}

.lesson-zen-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dfe9e2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(22, 41, 28, 0.05);
}

.lesson-zen-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lesson-zen-block-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #314239;
  font-size: 13px;
  font-weight: 800;
}

.lesson-zen-block-type b {
  display: inline-grid;
  min-width: 32px;
  height: 26px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8f5ec;
  color: var(--green);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.lesson-zen-title-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 800;
}

.lesson-zen-editable {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  line-height: 1.65;
  background: #fbfdfc;
  overflow-wrap: anywhere;
}

.lesson-zen-editable:focus {
  border-color: rgba(47, 111, 78, 0.45);
  box-shadow: 0 0 0 3px rgba(47, 111, 78, 0.08);
  background: #fff;
}

.lesson-zen-editable:empty::before {
  content: attr(data-placeholder);
  color: #8a968f;
}

.lesson-zen-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.lesson-zen-media-grid .full-field,
.lesson-zen-preview {
  grid-column: 1 / -1;
}

.lesson-zen-preview {
  display: grid;
  gap: 10px;
  min-height: 90px;
  place-items: center;
  padding: 12px;
  border: 1px dashed #c9d8cf;
  border-radius: 14px;
  background: #f8fbf9;
  color: #6f7b73;
}

.lesson-zen-preview img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 12px;
  object-fit: contain;
}

.lesson-article-image {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.lesson-article-image img {
  display: block;
  width: 100%;
  max-height: 620px;
  border-radius: 16px;
  object-fit: contain;
  background: #f5f7f5;
  border: 1px solid #e2e8e4;
}

.lesson-article-image figcaption,
.lesson-article-caption {
  margin: 0;
  color: #66716a;
  font-size: 14px;
  line-height: 1.5;
}

.lesson-article-download {
  justify-self: start;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.lesson-article-video iframe,
.lesson-pdf-frame {
  width: 100%;
  border: 0;
  border-radius: 16px;
  background: #f4f7f5;
}

.lesson-article-video iframe {
  aspect-ratio: 16 / 9;
  min-height: 260px;
}

.lesson-pdf-frame {
  min-height: 560px;
  margin-top: 10px;
  border: 1px solid #e1e8e3;
}

.lesson-article-file {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dfe9e2;
  border-radius: 14px;
  background: #fbfdfc;
}

.lesson-article-file-icon {
  display: grid;
  min-width: 52px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: #e8f5ec;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.lesson-article-file-body {
  display: grid;
  gap: 3px;
}

.lesson-article-file-body span,
.lesson-article-file-body small {
  color: #66716a;
}

.lesson-article-checklist {
  padding: 14px 16px;
  border: 1px solid #dfe9e2;
  border-radius: 14px;
  background: #f8fbf9;
}

.lesson-article-link a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 760px) {
  .lesson-zen-media-grid,
  .lesson-article-file {
    grid-template-columns: 1fr;
  }

  .lesson-zen-block-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .lesson-pdf-frame {
    min-height: 420px;
  }
}

/* === Admin course constructor redesign v4 === */
.course-builder-page{
  padding: 8px 4px 30px;
}
.course-builder-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding: 4px 0 16px;
  border-bottom:1px solid rgba(15,23,42,.08);
  margin-bottom:16px;
}
.course-builder-header h1{
  margin:0 0 12px;
  font-size:30px;
  line-height:1.1;
  letter-spacing:-.03em;
  color:#111827;
}
.course-builder-tabs{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:22px;
}
.course-builder-tabs button{
  border:0;
  background:transparent;
  color:#667085;
  font-weight:800;
  padding: 8px 0;
  border-bottom:3px solid transparent;
  cursor:pointer;
}
.course-builder-tabs button.active{
  color:#14773a;
  border-bottom-color:#14773a;
}
.course-builder-mini-status{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:5px 10px;
  background:#eefbf2;
  color:#14773a;
  font-weight:800;
  font-size:12px;
}
.course-builder-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.course-builder-course-select{
  display:flex;
  align-items:center;
  gap:10px;
  margin: 0 0 14px;
}
.course-builder-course-select label{
  color:#667085;
  font-weight:800;
}
.course-builder-workspace{
  display:grid;
  grid-template-columns: minmax(290px, 360px) minmax(460px, 1fr) minmax(230px, 285px);
  gap:16px;
  align-items:start;
}
.course-builder-tree,
.course-builder-editor,
.course-builder-inspector .panel{
  border:1px solid rgba(15,23,42,.09);
  box-shadow:0 8px 26px rgba(15,23,42,.04);
}
.course-builder-tree{
  position:sticky;
  top:14px;
  padding:0;
  overflow:hidden;
}
.course-builder-tree-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 18px 14px;
  border-bottom:1px solid rgba(15,23,42,.08);
}
.course-builder-tree-head h2,
.course-builder-editor-head h2,
.course-builder-status-card h2,
.course-builder-help-card h2{
  margin:0;
  font-size:20px;
  letter-spacing:-.02em;
}
.course-builder-tree-head p,
.course-builder-editor-head p{
  margin:4px 0 0;
  color:#667085;
  font-size:13px;
}
.course-builder-tree-search{
  display:flex;
  align-items:center;
  gap:8px;
  margin:14px;
  border:1px solid rgba(15,23,42,.1);
  border-radius:14px;
  padding:0 12px;
  background:#fbfcfb;
}
.course-builder-tree-search input{
  flex:1;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  padding:12px 0!important;
}
.course-builder-tree-list{
  padding:0 14px 12px;
  max-height: calc(100vh - 300px);
  overflow:auto;
}
.course-builder-module{
  border-bottom:1px solid rgba(15,23,42,.07);
  padding:10px 0 12px;
}
.course-builder-module-title{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:flex-start;
  padding:8px 0;
}
.course-builder-folder{
  color:#14773a;
  font-weight:900;
}
.course-builder-module-title b{
  display:block;
  color:#111827;
  font-size:14px;
}
.course-builder-module-title small{
  display:block;
  color:#667085;
  font-size:12px;
  margin-top:2px;
}
.course-builder-module-title em{
  font-style:normal;
  min-width:24px;
  height:24px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:#eef2f1;
  color:#64706c;
  font-weight:900;
  font-size:12px;
}
.course-builder-lessons{
  display:grid;
  gap:8px;
  margin:6px 0;
}
.course-builder-lesson-node{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:center;
  padding:12px 10px;
  border:1px solid rgba(15,23,42,.08);
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  transition:.18s ease;
}
.course-builder-lesson-node:hover{
  border-color:rgba(20,119,58,.35);
  background:#fbfffc;
}
.course-builder-lesson-node.selected{
  border-color:rgba(20,119,58,.45);
  background:linear-gradient(90deg, rgba(32,147,69,.1), rgba(255,255,255,.92));
  box-shadow:inset 3px 0 0 #14773a;
}
.course-builder-doc-icon{
  width:28px;
  height:28px;
  border-radius:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#f0f7f2;
  color:#14773a;
  font-weight:900;
}
.course-builder-lesson-node strong{
  display:block;
  color:#111827;
  font-size:13px;
  line-height:1.25;
}
.course-builder-lesson-node small{
  display:block;
  color:#667085;
  margin-top:3px;
  font-size:12px;
}
.course-builder-node-menu{
  border:0;
  background:transparent;
  color:#667085;
  font-size:20px;
  cursor:pointer;
}
.course-builder-add-lesson,
.course-builder-add-module{
  width:100%;
  border:1px dashed rgba(20,119,58,.35);
  background:#fbfffc;
  color:#14773a;
  border-radius:14px;
  padding:12px;
  font-weight:900;
  cursor:pointer;
}
.course-builder-add-module{
  margin:8px 14px 16px;
  width:calc(100% - 28px);
}
.course-builder-module-empty,
.course-builder-empty{
  border:1px dashed rgba(15,23,42,.12);
  border-radius:14px;
  padding:18px;
  color:#667085;
  background:#fbfcfb;
}
.course-builder-empty b,
.course-builder-empty span{
  display:block;
}
.course-builder-empty b{
  color:#111827;
  font-size:18px;
  margin-bottom:6px;
}
.course-builder-editor{
  padding:0;
  overflow:hidden;
}
.course-builder-editor-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:18px 20px 14px;
  border-bottom:1px solid rgba(15,23,42,.08);
}
.course-builder-editor-head-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.course-builder-editor-tabs{
  display:flex;
  align-items:center;
  gap:26px;
  padding:0 20px;
  border-bottom:1px solid rgba(15,23,42,.08);
  overflow:auto;
}
.course-builder-editor-tabs button{
  border:0;
  background:transparent;
  padding:14px 0 12px;
  font-weight:900;
  color:#667085;
  border-bottom:3px solid transparent;
  cursor:pointer;
  white-space:nowrap;
}
.course-builder-editor-tabs button.active{
  color:#14773a;
  border-bottom-color:#14773a;
}
.course-builder-content-editor{
  padding:18px 20px 20px;
}
.course-builder-content-note{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:12px 14px;
  border:1px solid rgba(20,119,58,.14);
  background:#f5fcf7;
  border-radius:14px;
  margin-bottom:14px;
}
.course-builder-content-note strong{
  color:#14773a;
  white-space:nowrap;
}
.course-builder-content-note span{
  color:#52605b;
}
.course-builder-save-row{
  display:flex;
  justify-content:flex-end;
  padding-top:14px;
}
.course-builder-inspector{
  position:sticky;
  top:14px;
  display:grid;
  gap:14px;
}
.course-builder-status-card,
.course-builder-help-card{
  padding:18px;
}
.course-builder-facts{
  display:grid;
  gap:13px;
  margin:14px 0 18px;
}
.course-builder-facts span{
  display:block;
  padding-bottom:12px;
  border-bottom:1px solid rgba(15,23,42,.07);
}
.course-builder-facts small{
  display:block;
  color:#667085;
  margin-bottom:5px;
  font-weight:800;
}
.course-builder-facts b{
  color:#111827;
}
.course-builder-help-card p{
  margin:10px 0;
  color:#52605b;
}
.course-builder-page .lesson-zen-editor{
  border:0;
  padding:0;
  background:transparent;
}
.course-builder-page .lesson-zen-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:16px;
}
.course-builder-page .lesson-zen-toolbar .btn{
  border-radius:12px;
  padding:10px 14px;
}
.course-builder-page .lesson-zen-feed{
  display:grid;
  gap:12px;
}
.course-builder-page .lesson-zen-block{
  border:1px solid rgba(15,23,42,.09);
  border-radius:14px;
  background:#fff;
  padding:14px;
  box-shadow:0 6px 16px rgba(15,23,42,.035);
}
.course-builder-page .lesson-zen-block-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.course-builder-page .lesson-zen-block-type{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  color:#111827;
}
.course-builder-page .lesson-zen-block-type b{
  width:32px;
  height:32px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#eefbf2;
  color:#14773a;
  font-size:12px;
}
.course-builder-page .lesson-zen-title-input,
.course-builder-page .lesson-zen-editable{
  width:100%;
  border:1px solid rgba(15,23,42,.1);
  border-radius:12px;
  padding:12px 14px;
  background:#fbfcfb;
  min-height:44px;
  outline:none;
}
.course-builder-page .lesson-zen-editable:focus,
.course-builder-page .lesson-zen-title-input:focus{
  border-color:rgba(20,119,58,.45);
  box-shadow:0 0 0 3px rgba(20,119,58,.08);
}
.course-builder-page .lesson-zen-media-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.course-builder-page .lesson-zen-media-grid .lesson-zen-preview{
  grid-column:1/-1;
  min-height:110px;
  border:1px dashed rgba(15,23,42,.14);
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fbfcfb;
  overflow:hidden;
  color:#667085;
}
.course-builder-page .lesson-zen-preview img{
  width:100%;
  max-height:240px;
  object-fit:cover;
  display:block;
}
.course-builder-page .user-form-grid,
.course-builder-page .lesson-editor-section{
  padding:18px 20px 20px;
}
.editor-empty{
  margin:18px 20px 20px;
}
@media (max-width: 1320px){
  .course-builder-workspace{grid-template-columns:minmax(260px,330px) minmax(420px,1fr)}
  .course-builder-inspector{grid-column:1/-1; position:static; grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width: 920px){
  .course-builder-header{flex-direction:column;}
  .course-builder-workspace{grid-template-columns:1fr;}
  .course-builder-tree,.course-builder-inspector{position:static;}
  .course-builder-inspector{grid-template-columns:1fr;}
  .course-builder-page .lesson-zen-media-grid{grid-template-columns:1fr;}
}

/* Student lesson reader redesign — clean Dzen-like article layout */
.student-lesson-page {
  display: grid;
  gap: 18px;
  padding-bottom: 32px;
}

.student-lesson-breadcrumbs {
  margin: 4px 0 -4px;
}

.student-lesson-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  padding: 24px;
  border: 1px solid #dfe9e2;
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 14%, rgba(47, 111, 78, 0.14), transparent 34%),
    linear-gradient(135deg, #f8fbf7 0%, #ffffff 52%, #eef7f1 100%);
  box-shadow: 0 12px 34px rgba(16, 40, 28, 0.07);
}

.student-lesson-hero-main {
  display: grid;
  gap: 14px;
  align-content: center;
}

.student-lesson-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.student-lesson-kicker span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f5ec;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.student-lesson-hero h1 {
  margin: 0;
  max-width: 900px;
  color: #141b17;
  font-size: clamp(28px, 3.1vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.student-lesson-hero p {
  max-width: 880px;
  margin: 0;
  color: #59645d;
  font-size: 16px;
  line-height: 1.7;
}

.student-lesson-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.student-lesson-progress-card {
  display: grid;
  gap: 10px;
  align-content: center;
  min-height: 190px;
  padding: 18px;
  border: 1px solid rgba(47, 111, 78, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 32px rgba(16, 40, 28, 0.07);
}

.student-lesson-progress-card span,
.student-lesson-progress-card small {
  color: #68736c;
  font-size: 13px;
  font-weight: 700;
}

.student-lesson-progress-card strong {
  color: #121915;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.student-lesson-progressbar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3ebe6;
}

.student-lesson-progressbar i {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: linear-gradient(90deg, #247441, #44a764);
}

.student-lesson-reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.student-lesson-reader {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.student-lesson-article {
  max-width: 980px;
  width: 100%;
  padding: 30px;
  border-radius: 24px;
}

.student-lesson-article .student-article-block {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  scroll-margin-top: 90px;
}

.student-lesson-article .student-article-block:last-child {
  margin-bottom: 0;
}

.student-lesson-article .lesson-formatted-content {
  gap: 16px;
}

.student-lesson-article .lesson-formatted-content p,
.student-lesson-article .lesson-content-text p,
.student-lesson-article .lesson-content-body p {
  color: #1f2b24;
  font-size: 17px;
  line-height: 1.82;
}

.student-lesson-article .lesson-formatted-content h2,
.student-lesson-article .lesson-block-heading {
  margin-top: 4px;
  color: #111814;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.student-lesson-article .lesson-formatted-content h3 {
  color: #111814;
  font-size: 22px;
}

.student-lesson-article .lesson-article-image {
  margin: 2px 0 4px;
}

.student-lesson-article .lesson-article-image img {
  max-height: 720px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(16, 40, 28, 0.08);
}

.student-lesson-article .lesson-article-file {
  border-radius: 18px;
  background: #f8fbf9;
}

.student-lesson-article .lesson-content-warning {
  padding: 18px 20px;
  border-radius: 18px;
  background: #fff8e6;
}

.student-lesson-article .lesson-article-checklist {
  padding: 18px 20px;
  border-radius: 18px;
}

.student-lesson-video {
  max-width: 980px;
}

.student-lesson-video .lesson-article-video iframe,
.student-lesson-video .lesson-video-card {
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(16, 40, 28, 0.09);
}

.student-lesson-empty-video {
  max-width: 980px;
  padding: 16px 18px;
  border: 1px dashed #d7e3dc;
  border-radius: 18px;
  background: #f8fbf9;
}

.student-lesson-empty-video span {
  display: block;
  color: #9b5d1a;
  font-weight: 900;
}

.student-lesson-empty-video p {
  margin: 5px 0 0;
  color: #66716a;
  line-height: 1.55;
}

.student-lesson-empty-content {
  display: grid;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #d7e3dc;
  border-radius: 18px;
  background: #f8fbf9;
}

.student-lesson-empty-content h2,
.student-lesson-empty-content p {
  margin: 0;
}

.student-lesson-homework-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff8e8, #ffffff);
}

.student-lesson-homework-card span {
  color: #ad6b20;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.student-lesson-homework-card h2,
.student-lesson-homework-card p {
  margin: 0;
}

.student-lesson-homework-card div {
  display: grid;
  gap: 7px;
}

.student-lesson-bottom-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 980px;
}

.student-lesson-side {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
}

.student-lesson-side-card {
  border-radius: 20px;
}

.student-lesson-side-card h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

.lesson-meta-list.clean {
  gap: 13px;
}

.lesson-meta-list.clean span {
  padding-bottom: 11px;
  border-bottom: 1px solid #eef3ef;
}

.lesson-meta-list.clean span:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.student-lesson-toc {
  display: grid;
  gap: 8px;
}

.student-lesson-toc a {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  color: #324039;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.student-lesson-toc a:hover {
  background: #eef7f1;
  color: var(--green);
}

@media (max-width: 1180px) {
  .student-lesson-reading-layout {
    grid-template-columns: 1fr;
  }

  .student-lesson-side {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .student-lesson-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .student-lesson-article {
    padding: 20px;
  }

  .student-lesson-side {
    grid-template-columns: 1fr;
  }

  .student-lesson-bottom-nav,
  .student-lesson-homework-card {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Student lesson clean reader: убрали правые блоки «О уроке» и «В уроке», контент стал шире */
.student-lesson-reading-layout-clean {
  grid-template-columns: minmax(0, 1fr);
}

.student-lesson-reader-wide {
  max-width: 1120px;
  width: 100%;
}

.student-lesson-reader-wide .student-lesson-article,
.student-lesson-reader-wide .student-lesson-video,
.student-lesson-reader-wide .student-lesson-empty-video,
.student-lesson-reader-wide .student-lesson-homework-card,
.student-lesson-reader-wide .student-lesson-bottom-nav {
  max-width: 1120px;
}

.student-lesson-reader-wide .lesson-article-image img {
  width: 100%;
  object-fit: contain;
}

/* Lesson content block rich formatting fix */
.lesson-block-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #f8fbf9;
}
.lesson-block-format-btn {
  appearance: none;
  border: 1px solid rgba(20, 119, 58, 0.18);
  border-radius: 10px;
  background: #fff;
  color: #173b27;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.lesson-block-format-btn:hover {
  border-color: rgba(20, 119, 58, 0.38);
  background: #eefbf2;
}
.lesson-zen-editable {
  font-size: 17px;
  line-height: 1.75;
}
.lesson-zen-editable p {
  margin: 0 0 14px;
}
.lesson-zen-editable p:last-child {
  margin-bottom: 0;
}
.lesson-zen-editable h2 {
  margin: 0 0 14px;
  font-size: 28px;
  line-height: 1.22;
  font-weight: 900;
  color: #111827;
}
.lesson-zen-editable h3 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 900;
  color: #16251c;
}
.lesson-zen-editable ul,
.lesson-zen-editable ol {
  margin: 0 0 14px 22px;
  padding: 0;
}
.lesson-zen-editable li {
  margin: 6px 0;
}
.lesson-zen-editable strong,
.lesson-zen-editable b {
  font-weight: 900;
}
.lesson-zen-editable em,
.lesson-zen-editable i {
  font-style: italic;
}
.course-builder-page .lesson-zen-editable {
  font-size: 17px;
  line-height: 1.75;
}
.course-builder-page .lesson-block-format-toolbar {
  margin-bottom: 10px;
}
@media (max-width: 780px) {
  .lesson-block-format-toolbar {
    gap: 5px;
  }
  .lesson-block-format-btn {
    padding: 7px 8px;
    font-size: 12px;
  }
  .lesson-zen-editable {
    font-size: 16px;
  }
}

/* Fix 2026-06-30: teacher messenger student list should not collapse to icon rail */
body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 280px !important;
  max-width: 380px !important;
  overflow: hidden !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-main,
body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-main-hint {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  grid-template-columns: none !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-pane {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chats-list {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) !important;
  width: 100% !important;
  min-width: 0 !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row-body,
body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row-top,
body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row-bottom {
  min-width: 0 !important;
}

body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row-name,
body[data-active="teacherDialog"] .teacher-dialog-sidebar.mentor-list-sidebar .teacher-dialog-chat-row-preview {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Step 70: clean calls and recordings layout */
body[data-active="calls"] .calls-main-tabs {
  margin-bottom: 14px;
}
body[data-active="calls"] .calls-filters {
  align-items: stretch;
  margin-bottom: 18px;
}
body[data-active="calls"] .calls-filters .search {
  min-width: min(520px, 100%);
}
body[data-active="calls"] .calls-clean-panel {
  overflow: visible;
}
.calls-clean-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.call-clean-row.call-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(120px, 150px) minmax(220px, auto);
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #edf0ed;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 45, 35, .035);
}
.call-clean-row.call-row:last-child {
  border-bottom: 1px solid #edf0ed;
}
.call-clean-row.with-recording {
  background: linear-gradient(90deg, rgba(31, 125, 61, .055), #fff 42%);
  padding-left: 16px;
  padding-right: 16px;
}
.call-clean-icon.row-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 14px;
}
.call-clean-record .call-clean-icon {
  background: #eef6ff;
  color: #315c91;
}
.call-clean-past .call-clean-icon {
  background: #f3f5f4;
  color: #718076;
}
.call-clean-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.call-clean-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.call-clean-title strong {
  font-size: 16px;
  line-height: 1.18;
}
.call-clean-main small,
.call-clean-date small,
.small-muted {
  color: var(--muted);
  line-height: 1.25;
}
.call-clean-date {
  display: grid;
  gap: 4px;
  color: var(--ink);
}
.call-clean-date b {
  line-height: 1.15;
}
.call-clean-actions.call-row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.call-clean-actions .btn {
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}
.call-more-menu {
  position: relative;
  display: inline-block;
}
.call-more-menu summary {
  list-style: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #dfe7e2;
  border-radius: 11px;
  background: #fff;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.call-more-menu summary::-webkit-details-marker {
  display: none;
}
.call-more-menu[open] summary {
  border-color: rgba(31, 125, 61, .35);
  background: #f4fbf6;
}
.call-more-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 25;
  min-width: 190px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #dfe7e2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(14, 31, 24, .14);
}
.call-more-menu button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}
.call-more-menu button:hover {
  background: #f3f7f4;
  color: var(--green);
}
.clean-calls-sidebar .quick-actions {
  display: grid;
  gap: 10px;
}
body[data-theme="dark"] .call-clean-row.call-row,
body[data-theme="dark"] .call-more-menu summary,
body[data-theme="dark"] .call-more-menu > div {
  background: var(--panel);
  border-color: var(--line);
}
body[data-theme="dark"] .call-clean-row.with-recording {
  background: linear-gradient(90deg, rgba(51, 180, 103, .10), var(--panel) 48%);
}
body[data-theme="dark"] .call-more-menu button:hover {
  background: rgba(255,255,255,.06);
}
@media (max-width: 1320px) {
  .call-clean-row.call-row {
    grid-template-columns: 44px minmax(0, 1fr) minmax(120px, auto);
  }
  .call-clean-actions.call-row-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
@media (max-width: 720px) {
  .call-clean-row.call-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .call-clean-date,
  .call-clean-actions.call-row-actions {
    grid-column: 2 / -1;
  }
  .call-clean-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .call-more-menu,
  .call-more-menu summary {
    width: 100%;
  }
}

/* Messenger unread badges: меню и верхняя панель */
.messenger-top-icon {
  font-size: 21px;
}

.top-icon span,
.messenger-top-icon span {
  min-width: 18px;
  width: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: #f04d4d;
  color: #fff;
  font-weight: 800;
  line-height: 18px;
}

/* Step 2026-06-30: Email/VK connection panels in all profiles */
.profile-channel-note {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px dashed rgba(31, 132, 76, 0.28);
  border-radius: 10px;
  background: rgba(31, 132, 76, 0.06);
  color: var(--muted);
  line-height: 1.45;
}

.profile-channel-note strong {
  color: var(--text);
}

.integration-panel,
.email-panel {
  padding: 22px;
}

.integration-panel .section-title,
.email-panel .section-title {
  align-items: flex-start;
}

.integration-connected,
.email-connected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.integration-connected > div:first-child,
.email-connected > div:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.integration-connected b,
.email-connected b {
  overflow-wrap: anywhere;
}

.integration-connected span,
.email-connected span {
  color: var(--muted);
  line-height: 1.45;
}

.integration-connected.muted-state,
.email-connected.muted-state {
  background: #f8faf8;
  border-style: dashed;
}

.email-panel .security-note,
.vk-panel .security-note {
  margin-top: 12px;
}

body[data-theme="dark"] .profile-channel-note {
  background: rgba(91, 196, 130, 0.08);
  border-color: rgba(120, 220, 157, 0.22);
}

body[data-theme="dark"] .profile-channel-note strong {
  color: var(--text);
}

body[data-theme="dark"] .integration-connected,
body[data-theme="dark"] .email-connected {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

@media (max-width: 720px) {
  .integration-connected,
  .email-connected {
    align-items: stretch;
    flex-direction: column;
  }

  .integration-connected .btn-row,
  .email-connected .btn-row {
    width: 100%;
  }

  .integration-connected .btn,
  .email-connected .btn {
    width: 100%;
  }
}

/* Lesson reader contrast fix — 2026-06-30
   Уроки у ученика читаются как светлая статья даже при включённой тёмной теме.
   Исправляет тёмный блок с почти невидимым текстом, геро-блок и материалы. */
.student-lesson-page {
  --lesson-paper: #ffffff;
  --lesson-paper-soft: #f8fbf9;
  --lesson-paper-line: #dfe9e2;
  --lesson-ink: #111814;
  --lesson-text: #253029;
  --lesson-muted: #5f6b64;
}

.student-lesson-hero,
body[data-theme="dark"] .student-lesson-hero {
  background:
    radial-gradient(circle at 92% 14%, rgba(47, 111, 78, 0.14), transparent 34%),
    linear-gradient(135deg, #f8fbf7 0%, #ffffff 52%, #eef7f1 100%) !important;
  border-color: var(--lesson-paper-line) !important;
  color: var(--lesson-text) !important;
}

.student-lesson-hero h1,
body[data-theme="dark"] .student-lesson-hero h1 {
  color: var(--lesson-ink) !important;
  opacity: 1 !important;
}

.student-lesson-hero p,
body[data-theme="dark"] .student-lesson-hero p {
  color: var(--lesson-muted) !important;
  opacity: 1 !important;
}

.student-lesson-progress-card,
body[data-theme="dark"] .student-lesson-progress-card {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(47, 111, 78, 0.16) !important;
  color: var(--lesson-text) !important;
}

.student-lesson-progress-card strong,
body[data-theme="dark"] .student-lesson-progress-card strong {
  color: var(--lesson-ink) !important;
}

.student-lesson-progress-card span,
.student-lesson-progress-card small,
body[data-theme="dark"] .student-lesson-progress-card span,
body[data-theme="dark"] .student-lesson-progress-card small {
  color: var(--lesson-muted) !important;
}

.student-lesson-article.panel,
body[data-theme="dark"] .student-lesson-article.panel {
  background: var(--lesson-paper) !important;
  border: 1px solid var(--lesson-paper-line) !important;
  color: var(--lesson-text) !important;
  box-shadow: 0 16px 40px rgba(16, 40, 28, 0.08) !important;
}

.student-lesson-article :where(h1, h2, h3, h4, .lesson-block-heading, strong, b),
body[data-theme="dark"] .student-lesson-article :where(h1, h2, h3, h4, .lesson-block-heading, strong, b) {
  color: var(--lesson-ink) !important;
  opacity: 1 !important;
}

.student-lesson-article :where(p, li, span, div, em),
.student-lesson-article .lesson-formatted-content :where(p, li, span, div, em),
.student-lesson-article .lesson-content-text p,
.student-lesson-article .lesson-content-body p,
body[data-theme="dark"] .student-lesson-article :where(p, li, span, div, em),
body[data-theme="dark"] .student-lesson-article .lesson-formatted-content :where(p, li, span, div, em),
body[data-theme="dark"] .student-lesson-article .lesson-content-text p,
body[data-theme="dark"] .student-lesson-article .lesson-content-body p {
  color: var(--lesson-text) !important;
  opacity: 1 !important;
}

.student-lesson-article .muted,
body[data-theme="dark"] .student-lesson-article .muted {
  color: var(--lesson-muted) !important;
}

.student-lesson-article .lesson-article-image,
body[data-theme="dark"] .student-lesson-article .lesson-article-image {
  background: #ffffff !important;
  border-radius: 20px;
}

.student-lesson-article .lesson-article-image img,
body[data-theme="dark"] .student-lesson-article .lesson-article-image img {
  display: block;
  background: #ffffff !important;
}

.student-lesson-empty-video,
body[data-theme="dark"] .student-lesson-empty-video,
.student-lesson-empty-content,
body[data-theme="dark"] .student-lesson-empty-content {
  background: var(--lesson-paper-soft) !important;
  border-color: var(--lesson-paper-line) !important;
  color: var(--lesson-text) !important;
}

.student-lesson-empty-video span,
body[data-theme="dark"] .student-lesson-empty-video span {
  color: #9b5d1a !important;
}

.student-lesson-empty-video p,
.student-lesson-empty-content p,
body[data-theme="dark"] .student-lesson-empty-video p,
body[data-theme="dark"] .student-lesson-empty-content p {
  color: var(--lesson-muted) !important;
}

.lesson-view-materials.panel,
body[data-theme="dark"] .lesson-view-materials.panel {
  background: var(--lesson-paper) !important;
  border: 1px solid var(--lesson-paper-line) !important;
  color: var(--lesson-text) !important;
}

.lesson-view-materials h2,
.lesson-view-materials strong,
body[data-theme="dark"] .lesson-view-materials h2,
body[data-theme="dark"] .lesson-view-materials strong {
  color: var(--lesson-ink) !important;
}

.lesson-view-materials .compact-row,
body[data-theme="dark"] .lesson-view-materials .compact-row {
  background: #fbfdfb !important;
  border: 1px solid #edf3ef !important;
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--lesson-text) !important;
}

.lesson-view-materials .compact-row span,
body[data-theme="dark"] .lesson-view-materials .compact-row span {
  color: var(--lesson-muted) !important;
}

.student-lesson-homework-card,
body[data-theme="dark"] .student-lesson-homework-card {
  background: linear-gradient(135deg, #fff8e8, #ffffff) !important;
  color: var(--lesson-text) !important;
  border: 1px solid #f0e2c4 !important;
}

.student-lesson-homework-card h2,
.student-lesson-homework-card strong,
body[data-theme="dark"] .student-lesson-homework-card h2,
body[data-theme="dark"] .student-lesson-homework-card strong {
  color: var(--lesson-ink) !important;
}

.student-lesson-homework-card p,
body[data-theme="dark"] .student-lesson-homework-card p {
  color: var(--lesson-muted) !important;
}

.student-lesson-bottom-nav .btn.secondary[disabled],
body[data-theme="dark"] .student-lesson-bottom-nav .btn.secondary[disabled] {
  opacity: .75;
}

@media (max-width: 860px) {
  .student-lesson-article.panel,
  body[data-theme="dark"] .student-lesson-article.panel {
    padding: 18px !important;
    border-radius: 20px;
  }
}

/* === ZG TOPBAR PROFILE FIX START === */
/* ZG TOPBAR PROFILE FIX v1
   Fixes profile chip wrapping under the header on desktop when page title/search/icons are present.
*/
@media (min-width: 1101px) {
  body .topbar,
  body .topbar.has-page-title {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    padding: 0 24px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body .topbar .hamburger {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    justify-self: auto !important;
  }

  body .topbar-page-title {
    flex: 1 1 auto !important;
    min-width: 220px !important;
    max-width: 520px !important;
    padding-left: 0 !important;
    overflow: hidden !important;
  }

  body .topbar-page-title strong,
  body .topbar-page-title small {
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body .topbar .top-search {
    flex: 1 1 420px !important;
    min-width: 260px !important;
    max-width: 520px !important;
  }

  body .topbar .theme-toggle,
  body .topbar .top-icon,
  body .topbar .profile-chip {
    flex: 0 0 auto !important;
  }

  body .topbar .profile-chip {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    align-self: center !important;
    margin: 0 !important;
    z-index: 3 !important;
  }

  body .topbar .profile-chip span:first-child {
    max-width: 120px !important;
  }
}

@media (min-width: 1101px) and (max-width: 1380px) {
  body .topbar .top-search {
    flex-basis: 300px !important;
    max-width: 360px !important;
  }
  body .topbar-page-title {
    max-width: 430px !important;
  }
}

@media (min-width: 1101px) and (max-width: 1240px) {
  body .topbar .top-search {
    display: none !important;
  }
  body .topbar-page-title {
    max-width: none !important;
  }
}
/* === ZG TOPBAR PROFILE FIX END === */

/* === ZEMGURU CALL REMINDERS SERVER V3 START === */
.zg-call-server-toast {
  position: fixed;
  z-index: 999999;
  right: 22px;
  top: 82px;
  width: min(390px, calc(100vw - 28px));
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(31, 126, 64, .98), rgba(20, 83, 45, .98));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.zg-call-server-toast.is-visible { opacity: 1; transform: translateY(0); }
.zg-call-server-toast strong { display:block; margin-bottom:6px; font-size:16px; line-height:1.2; }
.zg-call-server-toast span { display:block; color:rgba(255,255,255,.86); font-size:14px; line-height:1.35; }
@media (max-width: 768px) {
  .zg-call-server-toast { right: 14px; left: 14px; top: 72px; width: auto; }
}
/* === ZEMGURU CALL REMINDERS SERVER V3 END === */

/* =========================================================
   ZG Messenger message layout fix 2026-07-01
   Время сообщений внизу пузыря, шапка сообщения не растягивает карточку.
   ========================================================= */
.community-chat-feed .community-chat-message {
  align-items: flex-end !important;
}

.community-chat-feed .community-chat-bubble-tg {
  max-width: 100% !important;
  min-width: 0 !important;
  padding: 10px 12px 8px !important;
}

.community-chat-feed .community-chat-content,
.community-chat-feed .community-chat-body,
.community-chat-feed .community-chat-body-row {
  max-width: 100% !important;
  min-width: 0 !important;
}

.community-chat-feed .community-chat-author-line {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 7px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin-bottom: 7px !important;
}

.community-chat-feed .community-chat-author-line .community-chat-author {
  min-width: 0 !important;
  max-width: min(260px, 52vw) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
}

.community-chat-feed .community-chat-role,
.community-chat-feed .community-message-important-badge {
  flex: 0 0 auto !important;
}

.community-chat-feed .community-chat-author-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  margin-left: auto !important;
  flex: 0 0 auto !important;
}

.community-chat-feed .community-chat-author-actions .community-message-menu-wrap {
  margin-left: 0 !important;
}

.community-chat-feed .community-chat-author-line .community-chat-tail {
  margin-left: 0 !important;
}

.community-chat-feed .community-chat-body-row {
  display: block !important;
  width: auto !important;
  line-height: 1.45 !important;
}

.community-chat-feed .community-chat-body-row::after {
  content: "";
  display: block;
  clear: both;
}

.community-chat-feed .community-chat-body-row > .community-chat-text {
  display: inline !important;
  vertical-align: baseline !important;
}

.community-chat-feed .community-chat-body-row > .community-chat-tail {
  float: right !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 6px 0 0 12px !important;
  padding: 0 !important;
  white-space: nowrap !important;
  vertical-align: baseline !important;
}

.community-chat-feed .community-chat-tail .community-message-menu-wrap {
  margin-left: 3px !important;
}

.community-chat-feed .community-chat-time {
  font-size: 11px !important;
  line-height: 1 !important;
  color: rgba(15, 23, 42, 0.46) !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-time {
  color: rgba(15, 23, 42, 0.54) !important;
}

.community-chat-feed .community-chat-message.is-other .community-chat-bubble-tg {
  width: fit-content !important;
}

.community-chat-feed .community-chat-message.is-mine .community-chat-bubble-tg {
  width: fit-content !important;
}

body[data-theme="dark"] .community-chat-feed .community-chat-time {
  color: rgba(255, 255, 255, 0.58) !important;
}

body[data-theme="dark"] .community-chat-feed .community-chat-message.is-other .community-chat-time {
  color: rgba(17, 24, 39, 0.46) !important;
}

@media (max-width: 720px) {
  .community-chat-feed .community-chat-message {
    max-width: min(92%, 640px) !important;
  }

  .community-chat-feed .community-chat-author-line .community-chat-author {
    max-width: 46vw !important;
  }

  .community-chat-feed .community-chat-bubble-tg {
    padding: 9px 10px 7px !important;
  }
}

/* ZEMGURU CALL SIDEBAR FIX START */
.right-rail .rail-row.call-reminder {
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 10px 0;
  padding: 12px 12px 11px;
  border: 1px solid rgba(22, 35, 28, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,248,0.98) 100%);
  box-shadow: 0 8px 22px rgba(17, 31, 23, 0.04);
}

.right-rail .rail-row.call-reminder .rail-icon {
  align-self: start;
  margin-top: 2px;
}

.right-rail .rail-row.call-reminder > div {
  min-width: 0;
}

.right-rail .rail-row.call-reminder strong {
  margin: 0 0 4px;
  line-height: 1.25;
}

.right-rail .rail-row.call-reminder small {
  display: block;
  line-height: 1.35;
}

.right-rail .rail-row.call-reminder .call-reminder-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.right-rail .rail-row.call-reminder.call-reminder--planned {
  border-color: rgba(45, 135, 64, 0.16);
  box-shadow: 0 8px 20px rgba(45, 135, 64, 0.06);
  background: linear-gradient(180deg, rgba(247, 252, 248, 0.98) 0%, rgba(242, 249, 244, 0.98) 100%);
}
.right-rail .rail-row.call-reminder.call-reminder--planned .call-reminder-status,
.right-rail .rail-row.call-reminder.call-reminder--soon .call-reminder-status {
  color: #23723d;
  background: rgba(45, 135, 64, 0.10);
  border-color: rgba(45, 135, 64, 0.14);
}

.right-rail .rail-row.call-reminder.call-reminder--live {
  border-color: rgba(214, 170, 39, 0.18);
  box-shadow: 0 8px 20px rgba(214, 170, 39, 0.07);
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.98) 0%, rgba(255, 249, 232, 0.98) 100%);
}
.right-rail .rail-row.call-reminder.call-reminder--live .call-reminder-status {
  color: #8a6810;
  background: rgba(214, 170, 39, 0.14);
  border-color: rgba(214, 170, 39, 0.16);
}

.right-rail .rail-row.call-reminder.call-reminder--cancelled {
  border-color: rgba(196, 67, 67, 0.14);
  box-shadow: 0 8px 20px rgba(196, 67, 67, 0.05);
  background: linear-gradient(180deg, rgba(255, 249, 249, 0.98) 0%, rgba(255, 244, 244, 0.98) 100%);
}
.right-rail .rail-row.call-reminder.call-reminder--cancelled .call-reminder-status {
  color: #a54848;
  background: rgba(196, 67, 67, 0.10);
  border-color: rgba(196, 67, 67, 0.12);
}
.right-rail .rail-row.call-reminder.call-reminder--cancelled small {
  color: #936565;
}

body[data-theme="dark"] .right-rail .rail-row.call-reminder {
  border-color: rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(18,31,24,0.96) 0%, rgba(14,24,20,0.96) 100%);
  box-shadow: 0 10px 22px rgba(0,0,0,0.20);
}
body[data-theme="dark"] .right-rail .rail-row.call-reminder.call-reminder--planned {
  border-color: rgba(66, 174, 95, 0.18);
  box-shadow: 0 10px 24px rgba(41, 131, 68, 0.14);
}
body[data-theme="dark"] .right-rail .rail-row.call-reminder.call-reminder--live {
  border-color: rgba(214, 170, 39, 0.22);
  box-shadow: 0 10px 24px rgba(214, 170, 39, 0.12);
}
body[data-theme="dark"] .right-rail .rail-row.call-reminder.call-reminder--cancelled {
  border-color: rgba(196, 67, 67, 0.18);
  box-shadow: 0 10px 24px rgba(196, 67, 67, 0.12);
}
/* ZEMGURU CALL SIDEBAR FIX END */

/* ZEMGURU LESSON COMPLETE PROGRESS FIX START */
.zg-lesson-complete-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(35, 122, 58, 0.16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(249, 253, 250, 0.98) 0%, rgba(243, 250, 245, 0.98) 100%);
  box-shadow: 0 12px 30px rgba(20, 75, 38, 0.06);
}

.zg-lesson-complete-card.is-completed {
  border-color: rgba(35, 122, 58, 0.22);
  background: linear-gradient(180deg, rgba(245, 252, 247, 0.98) 0%, rgba(237, 248, 240, 0.98) 100%);
}

.zg-lesson-complete-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.zg-lesson-complete-card__head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.15;
  color: #142033;
}

.zg-lesson-complete-card__head p {
  margin: 0;
  color: #667085;
  line-height: 1.45;
}

.zg-lesson-complete-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #237a3a;
  background: rgba(35, 122, 58, 0.10);
  border: 1px solid rgba(35, 122, 58, 0.14);
}

.zg-lesson-complete-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.zg-lesson-complete-card .btn[disabled] {
  opacity: .72;
  cursor: default;
}

.zg-lesson-complete-note {
  margin: 10px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.student-lesson-progress-card.zg-lesson-viewed-pulse {
  box-shadow: 0 0 0 4px rgba(35, 122, 58, 0.12), 0 12px 30px rgba(20, 75, 38, 0.08);
}

body[data-theme="dark"] .zg-lesson-complete-card {
  border-color: rgba(107, 199, 128, 0.20);
  background: linear-gradient(180deg, rgba(18, 31, 24, 0.96) 0%, rgba(14, 24, 20, 0.96) 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.20);
}

body[data-theme="dark"] .zg-lesson-complete-card__head h2 {
  color: #f4fbf6;
}

body[data-theme="dark"] .zg-lesson-complete-card__head p,
body[data-theme="dark"] .zg-lesson-complete-note {
  color: rgba(244, 251, 246, 0.72);
}

@media (max-width: 720px) {
  .zg-lesson-complete-card {
    padding: 16px;
    border-radius: 16px;
  }
  .zg-lesson-complete-card__head {
    flex-direction: column;
  }
  .zg-lesson-complete-card__head h2 {
    font-size: 20px;
  }
  .zg-lesson-complete-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
/* ZEMGURU LESSON COMPLETE PROGRESS FIX END */

/* ZEMGURU PROFILE NOTIFICATIONS ROUTE FIX START */
.profile-notifications-focus {
  outline: 2px solid rgba(34, 122, 55, 0.24);
  box-shadow: 0 0 0 6px rgba(34, 122, 55, 0.08);
  border-radius: 16px;
  transition: box-shadow .25s ease, outline-color .25s ease;
}

.profile-form .notification-jump-note {
  display: none;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 122, 55, 0.08);
  color: #1f6f37;
  font-weight: 700;
}

.profile-form.profile-notifications-focus .notification-jump-note {
  display: block;
}
/* ZEMGURU PROFILE NOTIFICATIONS ROUTE FIX END */

/* ZEMGURU USER MODAL DRAFT FIX START */
.zg-user-draft-note {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(45, 135, 64, 0.18);
  border-radius: 12px;
  background: rgba(45, 135, 64, 0.07);
  color: #216b35;
  font-size: 13px;
  font-weight: 700;
}

.zg-user-draft-note.is-visible {
  display: flex;
}

.zg-user-draft-note button {
  border: 0;
  background: transparent;
  color: #1f6f38;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

body[data-theme="dark"] .zg-user-draft-note {
  border-color: rgba(92, 198, 120, 0.20);
  background: rgba(92, 198, 120, 0.10);
  color: #9ce4ae;
}
body[data-theme="dark"] .zg-user-draft-note button {
  color: #9ce4ae;
}
/* ZEMGURU USER MODAL DRAFT FIX END */

/* ZEMGURU NOTIFICATIONS CALL DIFF FIX START */
.notification-card .notification-main .zg-call-change-summary {
  display: grid;
  gap: 7px;
  margin: 10px 0 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 122, 55, 0.06);
  border: 1px solid rgba(34, 122, 55, 0.12);
}

.notification-card .notification-main .zg-call-change-summary b {
  color: #172033;
}

.notification-card .notification-main .zg-call-change-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 13px;
  line-height: 1.35;
}

.notification-card .notification-main .zg-call-change-row span:first-child {
  color: #6b7280;
  font-weight: 700;
}

.notification-card .notification-main .zg-call-change-arrow {
  color: #237a3a;
  font-weight: 800;
  padding: 0 4px;
}

.notification-card .notification-main .zg-call-muted {
  color: #6b7280;
}

.notification-card .notification-main .zg-call-admin-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(72, 94, 124, .10);
  color: #485e7c;
  font-size: 12px;
  font-weight: 800;
}

body[data-theme="dark"] .notification-card .notification-main .zg-call-change-summary {
  background: rgba(72, 187, 120, 0.08);
  border-color: rgba(72, 187, 120, 0.14);
}
body[data-theme="dark"] .notification-card .notification-main .zg-call-change-summary b {
  color: #f2f7f3;
}
body[data-theme="dark"] .notification-card .notification-main .zg-call-change-row span:first-child,
body[data-theme="dark"] .notification-card .notification-main .zg-call-muted {
  color: rgba(242,247,243,.68);
}

@media (max-width: 720px) {
  .notification-card .notification-main .zg-call-change-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
/* ZEMGURU NOTIFICATIONS CALL DIFF FIX END */

/* ZEMGURU RECORD MODAL DRAFT FIX START */
.zg-draft-badge {
  position: sticky;
  top: 0;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(45, 135, 64, .18);
  background: rgba(45, 135, 64, .08);
  color: #207238;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.zg-draft-badge.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.zg-draft-restored {
  animation: zgDraftPulse 1.2s ease;
}

@keyframes zgDraftPulse {
  0% { box-shadow: 0 0 0 0 rgba(45, 135, 64, .28); }
  100% { box-shadow: 0 0 0 12px rgba(45, 135, 64, 0); }
}

body[data-theme="dark"] .zg-draft-badge,
.dark .zg-draft-badge {
  border-color: rgba(106, 216, 135, .24);
  background: rgba(106, 216, 135, .11);
  color: #9cf0af;
}
/* ZEMGURU RECORD MODAL DRAFT FIX END */


/* ZEMGURU STUDENT LEVEL FIX START */
.user-modal [data-user-student-level],
.user-modal [data-invite-student-level] {
  font-weight: 700;
}
.user-modal .student-level-help {
  margin-top: 6px;
  color: var(--muted, #6b7280);
  font-size: 12px;
  line-height: 1.35;
}
.user-modal .student-level-help b {
  color: var(--text, #111827);
}
/* ZEMGURU STUDENT LEVEL FIX END */

/* ZEMGURU ADMIN CALLS ORDER HARD FIX CSS START */
.admin-call-oper-board,
.admin-call-records-board {
  display: grid;
  gap: 18px;
}
.admin-call-oper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.admin-call-oper-head h2,
.admin-call-records-board h2 {
  margin: 0;
}
.admin-call-oper-head p,
.admin-call-records-board p {
  margin: 6px 0 0;
}
.admin-call-oper-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.admin-call-oper-kpis > div {
  border: 1px solid var(--border, #e2e8e2);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,.74);
}
.admin-call-oper-kpis b {
  display: block;
  font-size: 30px;
  line-height: 1;
  color: var(--green, #187033);
}
.admin-call-oper-kpis span {
  display: block;
  margin-top: 6px;
  color: var(--muted, #6b7280);
  font-weight: 700;
  font-size: 13px;
}
.admin-call-oper-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px 180px 180px;
  gap: 10px;
}
.admin-call-oper-tools .search,
.admin-call-oper-tools .filter {
  min-height: 48px;
}
.admin-call-group-block {
  border: 1px solid var(--border, #dde7dd);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(20, 44, 30, .055);
}
.admin-call-group-block.is-archived {
  opacity: .78;
}
.admin-call-group-block-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(33, 92, 51, .10);
  background: linear-gradient(180deg, rgba(246,252,247,.95), rgba(255,255,255,.92));
}
.admin-call-group-block-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-call-group-block-title h3 {
  margin: 0;
  font-size: 22px;
}
.admin-call-group-block-head .muted {
  margin-top: 6px;
}
.admin-call-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.admin-call-group-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(33,92,51,.08);
}
.admin-call-group-stats div {
  border: 1px solid rgba(33,92,51,.10);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(248,251,249,.8);
}
.admin-call-group-stats b {
  display: block;
  font-size: 22px;
}
.admin-call-group-stats span {
  display: block;
  color: var(--muted, #6b7280);
  font-size: 12px;
  font-weight: 700;
}
.admin-call-group-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}
.admin-call-group-column {
  border: 1px solid rgba(33,92,51,.09);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.78);
  min-width: 0;
}
.admin-call-group-column h4 {
  margin: 0 0 10px;
  font-size: 16px;
}
.admin-call-mini-row,
.admin-record-group-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(33,92,51,.08);
  border-radius: 14px;
  background: rgba(250,252,250,.95);
  margin-top: 8px;
}
.admin-record-group-row {
  grid-template-columns: 36px minmax(0, 1.4fr) minmax(130px, .35fr) auto;
}
.admin-call-mini-row .row-icon,
.admin-record-group-row .row-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef7f0;
  color: #187033;
  font-weight: 900;
}
.admin-call-mini-row strong,
.admin-record-group-row strong {
  display: block;
  line-height: 1.25;
}
.admin-call-mini-row small,
.admin-record-group-row small {
  display: block;
  color: var(--muted, #6b7280);
  margin-top: 4px;
  line-height: 1.35;
}
.admin-record-group-date b,
.admin-record-group-date small {
  display: block;
}
.admin-record-group-date small {
  color: var(--muted, #6b7280);
  margin-top: 4px;
}
.admin-record-group-actions,
.admin-call-mini-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.admin-call-empty-note {
  border: 1px dashed rgba(33,92,51,.22);
  border-radius: 14px;
  padding: 14px;
  color: var(--muted, #6b7280);
  background: rgba(248,251,249,.55);
}
.admin-call-section-label {
  margin: 18px 0 10px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}
.admin-call-section-label h3 { margin: 0; }
.admin-call-records-board .admin-call-group-block-head {
  background: linear-gradient(180deg, rgba(245,250,255,.96), rgba(255,255,255,.93));
}
.admin-call-group-record-list {
  padding: 14px 20px 20px;
}
.admin-record-group-row:first-child { margin-top: 0; }
.admin-call-current-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(34, 124, 55, .10);
  color: #187033;
  font-weight: 800;
  font-size: 12px;
}
.admin-call-flat-warning {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 171, 64, .25);
  background: rgba(255, 248, 232, .85);
  color: #6d4b12;
  font-weight: 700;
}
body[data-theme="dark"] .admin-call-oper-kpis > div,
body[data-theme="dark"] .admin-call-group-block,
body[data-theme="dark"] .admin-call-group-column,
body[data-theme="dark"] .admin-call-mini-row,
body[data-theme="dark"] .admin-record-group-row {
  background: rgba(17, 31, 24, .88);
  border-color: rgba(255,255,255,.10);
}
body[data-theme="dark"] .admin-call-group-block-head {
  background: linear-gradient(180deg, rgba(21,41,30,.95), rgba(15,29,22,.92));
}
@media (max-width: 1100px) {
  .admin-call-oper-kpis,
  .admin-call-group-stats,
  .admin-call-group-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-call-oper-tools { grid-template-columns: 1fr 1fr; }
  .admin-record-group-row { grid-template-columns: 34px minmax(0, 1fr); }
  .admin-record-group-date,
  .admin-record-group-actions { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .admin-call-oper-head,
  .admin-call-group-block-head { grid-template-columns: 1fr; display: grid; }
  .admin-call-oper-kpis,
  .admin-call-group-stats,
  .admin-call-group-columns,
  .admin-call-oper-tools { grid-template-columns: 1fr; }
  .admin-call-group-actions { justify-content: flex-start; }
}
/* ZEMGURU ADMIN CALLS ORDER HARD FIX CSS END */

/* ZEMGURU RECORD TITLE FINAL REPAIR CSS START */
.record-title-final-field {
  margin: 14px 0 12px;
}
.record-title-final-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
  color: var(--text, #111827);
}
.record-title-final-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border, #d9e0da);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text, #111827);
  background: var(--surface, #fff);
  outline: none;
}
.record-title-final-field input:focus {
  border-color: #2f8d46;
  box-shadow: 0 0 0 3px rgba(47, 141, 70, .12);
}
.record-title-final-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted, #6b7280);
  font-size: 13px;
  line-height: 1.35;
}
body[data-theme="dark"] .record-title-final-field input {
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.94);
  border-color: rgba(255,255,255,.14);
}
body[data-theme="dark"] .record-title-final-hint {
  color: rgba(255,255,255,.58);
}
/* ZEMGURU RECORD TITLE FINAL REPAIR CSS END */

/* ZEMGURU MODAL INPUT STABILITY FIX CSS START */
.zg-draft-stable-badge {
  display: none;
  width: max-content;
  align-items: center;
  margin: 8px 0 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(45, 135, 64, 0.10);
  color: #1e7a3a;
  border: 1px solid rgba(45, 135, 64, 0.16);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus,
[role="dialog"] input:focus,
[role="dialog"] textarea:focus,
[role="dialog"] select:focus {
  outline: 2px solid rgba(67, 129, 219, 0.35);
  outline-offset: 1px;
}
/* ZEMGURU MODAL INPUT STABILITY FIX CSS END */

/* ZEMGURU MODAL DRAFT CLEAR FIX START */
.zg-draft-clear-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.zg-draft-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(190, 54, 54, 0.22);
  background: rgba(190, 54, 54, 0.07);
  color: #a33232;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.zg-draft-clear-btn:hover {
  background: rgba(190, 54, 54, 0.12);
  border-color: rgba(190, 54, 54, 0.32);
}

.zg-draft-cleared-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(45, 135, 64, 0.10);
  color: #23723d;
  font-size: 12px;
  font-weight: 800;
}

body[data-theme="dark"] .zg-draft-clear-btn,
.theme-dark .zg-draft-clear-btn {
  background: rgba(255, 112, 112, 0.10);
  border-color: rgba(255, 112, 112, 0.24);
  color: #ffb1b1;
}
/* ZEMGURU MODAL DRAFT CLEAR FIX END */


/* ZEMGURU TOPIC COMPACT PIN CLEAN FIX CSS START */
.zg-topic-compact-pin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: calc(100% - 28px);
  max-width: 980px;
  margin: 10px auto 8px;
  padding: 10px 12px;
  border: 1px solid rgba(45, 135, 64, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,252,248,0.96));
  box-shadow: 0 10px 26px rgba(17, 31, 23, 0.07);
  color: #172033;
  flex: 0 0 auto;
}

.zg-topic-compact-pin.is-hidden {
  display: none !important;
}

.zg-topic-compact-pin-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.zg-topic-compact-pin-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(45, 135, 64, 0.08);
  color: #23723d;
  flex: 0 0 auto;
}

.zg-topic-compact-pin-body {
  min-width: 0;
  flex: 1 1 auto;
}

.zg-topic-compact-pin-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.zg-topic-compact-pin-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(45, 135, 64, 0.10);
  color: #23723d;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.zg-topic-compact-pin-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 900;
  color: #172033;
}

.zg-topic-compact-pin-preview {
  margin: 4px 0 0;
  max-width: 820px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
}

.zg-topic-compact-pin-full {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(45, 135, 64, 0.06);
  color: #1f2937;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.zg-topic-compact-pin.is-expanded .zg-topic-compact-pin-preview {
  display: none;
}

.zg-topic-compact-pin.is-expanded .zg-topic-compact-pin-full {
  display: block;
}

.zg-topic-compact-pin-meta {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  line-height: 1.3;
}

.zg-topic-compact-pin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.zg-topic-compact-pin-btn {
  appearance: none;
  border: 1px solid rgba(45, 135, 64, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #23723d;
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1;
  font-weight: 850;
  cursor: pointer;
}

.zg-topic-compact-pin-btn:hover {
  background: rgba(45, 135, 64, 0.07);
}

.teacher-dialog-chat-pane.has-compact-topic-pin .community-chat-feed,
.teacher-dialog-chat-pane.has-compact-topic-pin .teacher-private-chat-feed {
  min-height: 0;
}

body[data-theme="dark"] .zg-topic-compact-pin,
.theme-dark .zg-topic-compact-pin {
  background: linear-gradient(180deg, rgba(20, 35, 27, 0.96), rgba(14, 27, 21, 0.96));
  border-color: rgba(119, 207, 139, 0.16);
  box-shadow: 0 12px 30px rgba(0,0,0,0.26);
  color: #f5f7f5;
}

body[data-theme="dark"] .zg-topic-compact-pin-title,
.theme-dark .zg-topic-compact-pin-title { color: #f5f7f5; }

body[data-theme="dark"] .zg-topic-compact-pin-preview,
.theme-dark .zg-topic-compact-pin-preview,
body[data-theme="dark"] .zg-topic-compact-pin-meta,
.theme-dark .zg-topic-compact-pin-meta { color: rgba(238,245,239,0.72); }

body[data-theme="dark"] .zg-topic-compact-pin-full,
.theme-dark .zg-topic-compact-pin-full {
  background: rgba(119,207,139,0.08);
  color: #eef5ef;
}

body[data-theme="dark"] .zg-topic-compact-pin-btn,
.theme-dark .zg-topic-compact-pin-btn {
  background: rgba(255,255,255,0.04);
  border-color: rgba(158,230,170,0.18);
  color: #a7efb2;
}

@media (max-width: 860px) {
  .zg-topic-compact-pin {
    width: calc(100% - 18px);
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 11px;
  }
  .zg-topic-compact-pin-actions {
    width: 100%;
  }
  .zg-topic-compact-pin-btn {
    flex: 1 1 auto;
  }
}
/* ZEMGURU TOPIC COMPACT PIN CLEAN FIX CSS END */
/* ZG SEPARATE NOTIFICATION EMAIL STYLES START */
.zg-notification-email-box {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.25fr);
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--green, #24833f) 28%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--green, #24833f) 7%, transparent);
}
.zg-notification-email-copy { display: grid; gap: 5px; }
.zg-notification-email-copy strong { font-size: 1rem; }
.zg-notification-email-copy span,
.zg-login-email-help { color: var(--muted, #6b7280); line-height: 1.42; }
.zg-notification-email-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.zg-notification-email-controls input {
  width: 100%; min-width: 0; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line, rgba(127,127,127,.28));
  background: var(--surface, transparent); color: inherit; font: inherit;
}
.zg-notification-email-toast {
  position: fixed; z-index: 100000; right: 22px; bottom: 22px; max-width: min(440px, calc(100vw - 32px));
  padding: 13px 16px; border-radius: 12px; background: #176f38; color: #fff;
  font-weight: 700; box-shadow: 0 14px 34px rgba(0,0,0,.22);
}
.zg-notification-email-toast.error { background: #b42318; }
@media (max-width: 780px) {
  .zg-notification-email-box { grid-template-columns: 1fr; }
  .zg-notification-email-controls { grid-template-columns: 1fr; }
  .zg-notification-email-controls .btn { width: 100%; }
}
/* ZG SEPARATE NOTIFICATION EMAIL STYLES END */

/* === ZG MOBILE TOPBAR PROFILE FIX 2026-07-02 START ===
   Keeps the profile avatar inside the top header on phones.
   The previous four-column mobile grid had five visible controls,
   so the profile chip wrapped into a second row above the page content.
*/
@media (max-width: 760px) {
  body .topbar,
  body .topbar.has-page-title {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px 42px !important;
    grid-template-rows: 68px !important;
    grid-auto-rows: 0 !important;
    align-items: center !important;
    gap: 6px !important;
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    padding: 0 12px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body .topbar .topbar-page-title,
  body .topbar .top-search {
    display: none !important;
  }

  body .topbar .hamburger,
  body .topbar .theme-toggle,
  body .topbar .messenger-top-icon,
  body .topbar > .top-icon:not(.messenger-top-icon),
  body .topbar .profile-chip {
    grid-row: 1 !important;
    margin: 0 !important;
    align-self: center !important;
  }

  body .topbar .hamburger {
    grid-column: 1 !important;
    justify-self: start !important;
  }

  body .topbar .theme-toggle {
    grid-column: 2 !important;
    justify-self: center !important;
  }

  body .topbar .messenger-top-icon {
    grid-column: 3 !important;
    justify-self: center !important;
  }

  body .topbar > .top-icon:not(.messenger-top-icon) {
    grid-column: 4 !important;
    justify-self: center !important;
  }

  body .topbar .profile-chip {
    grid-column: 5 !important;
    justify-self: end !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 2px !important;
    border-radius: 999px !important;
    position: relative !important;
    inset: auto !important;
    transform: none !important;
  }

  body .topbar .profile-chip > span:first-child {
    display: none !important;
  }

  body .topbar .profile-chip .avatar {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    flex: 0 0 38px !important;
  }

  body .topbar .profile-menu {
    top: 60px !important;
    right: 10px !important;
  }
}
/* === ZG MOBILE TOPBAR PROFILE FIX 2026-07-02 END === */


/* ZG PROFILE NICKNAME AUTOSAVE START */
.nickname-autosave-status {
  display: block;
  min-height: 1.25em;
  margin-top: 6px;
  color: var(--muted, #737983);
  font-size: 0.82rem;
}
.nickname-autosave-status.saving { color: #4f7db5; }
.nickname-autosave-status.saved { color: #2d8241; }
.nickname-autosave-status.error { color: #c44444; }
/* ZG PROFILE NICKNAME AUTOSAVE END */

/* === ZG EMAIL PANEL SPACING FIX 2026-07-02 START ===
   Separates the email settings blocks and keeps the action buttons aligned.
*/
.email-panel.integration-panel {
  display: grid;
  gap: 18px;
  padding: 26px 28px;
}

.email-panel.integration-panel > .section-title,
.email-panel.integration-panel > .email-connected,
.email-panel.integration-panel > .zg-notification-email-box,
.email-panel.integration-panel > .toggle-row,
.email-panel.integration-panel > .security-note {
  margin: 0;
}

.email-panel.integration-panel > .section-title {
  margin-bottom: 2px;
}

.email-panel.integration-panel .email-connected {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 22px 24px;
}

.email-panel.integration-panel .email-connected > div:first-child {
  gap: 7px;
}

.email-panel.integration-panel .email-connected .btn-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: auto;
}

.email-panel.integration-panel .email-connected .btn-row .btn {
  width: auto;
  min-width: 160px;
  white-space: nowrap;
}

.email-panel.integration-panel .email-connected .btn-row .zg-important-email-test-btn {
  min-width: 205px;
}

.email-panel.integration-panel .zg-notification-email-box {
  grid-template-columns: minmax(300px, .9fr) minmax(430px, 1.1fr);
  gap: 30px;
  padding: 24px 26px;
}

.email-panel.integration-panel .zg-notification-email-copy {
  gap: 8px;
}

.email-panel.integration-panel .zg-notification-email-copy span {
  max-width: 560px;
}

.email-panel.integration-panel .zg-notification-email-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.email-panel.integration-panel .zg-notification-email-controls input,
.email-panel.integration-panel .zg-notification-email-controls .btn {
  min-height: 46px;
}

.email-panel.integration-panel .zg-notification-email-controls .btn {
  min-width: 175px;
  white-space: nowrap;
}

.email-panel.integration-panel .toggle-row.compact {
  padding: 16px 20px;
}

.email-panel.integration-panel .security-note {
  padding: 13px 16px;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .email-panel.integration-panel .email-connected {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .email-panel.integration-panel .email-connected .btn-row {
    justify-content: flex-start;
  }

  .email-panel.integration-panel .zg-notification-email-box {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 760px) {
  .email-panel.integration-panel {
    gap: 14px;
    padding: 18px 16px;
  }

  .email-panel.integration-panel .section-title {
    align-items: flex-start;
    gap: 10px;
  }

  .email-panel.integration-panel .email-connected {
    padding: 18px;
  }

  .email-panel.integration-panel .email-connected .btn-row,
  .email-panel.integration-panel .zg-notification-email-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .email-panel.integration-panel .email-connected .btn-row .btn,
  .email-panel.integration-panel .zg-notification-email-controls .btn {
    width: 100%;
    min-width: 0;
  }

  .email-panel.integration-panel .zg-notification-email-box {
    padding: 18px;
  }
}
/* === ZG EMAIL PANEL SPACING FIX 2026-07-02 END === */


/* First-login profile setup: nickname + password */
.first-login-setup-modal {
  width: min(660px, 100%);
}

.first-login-setup-grid {
  margin-top: 18px;
}

.first-login-nickname-field {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px solid rgba(36, 115, 56, .22);
  border-radius: 14px;
  background: rgba(36, 115, 56, .06);
}

.first-login-nickname-field input {
  font-size: 17px;
  font-weight: 650;
}

.field-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.first-login-setup-actions {
  margin-top: 18px;
}

.first-login-setup-actions .btn {
  min-width: 210px;
}

@media (max-width: 680px) {
  .first-login-setup-modal {
    width: 100%;
    padding: 18px;
  }

  .first-login-setup-grid {
    grid-template-columns: 1fr;
  }

  .first-login-nickname-field {
    grid-column: auto;
  }

  .first-login-setup-actions .btn {
    width: 100%;
  }
}


/* ZG NOTIFICATION FEED CLEANUP 2026-07-02 START */
.notification-time-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: var(--ink);
}

.notification-card.read .notification-time-label {
  color: var(--muted);
}

.notice-task small {
  display: grid;
  gap: 3px;
}

.notice-task-time {
  display: block !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, .48);
  transform-origin: left center;
  animation: zgToastLifetime 6.5s linear forwards;
}

@keyframes zgToastLifetime {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 760px) {
  .notification-meta {
    gap: 7px;
  }
  .notification-time-label {
    width: 100%;
  }
}
/* ZG NOTIFICATION FEED CLEANUP 2026-07-02 END */


/* ZG notification connection truth fix 2026-07-02 */
.notification-settings-summary .setting-row .setting-status {
  white-space: nowrap;
  font-weight: 800;
}
.notification-settings-summary .setting-row .setting-status.on {
  color: var(--green);
}
.notification-settings-summary .setting-row .setting-status.off {
  color: #d66a6a;
}
.notification-settings-summary .setting-row .setting-status.paused {
  color: #d59a2f;
}
.notification-settings-hint {
  margin: 14px 0 12px;
  font-size: 12px;
  line-height: 1.45;
}
.email-panel .toggle-row.is-disabled {
  opacity: .72;
}
.email-panel .toggle-row.is-disabled input {
  cursor: not-allowed;
}
.email-panel [data-send-email-test]:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Step 07: Telegram account connection in profile */
.telegram-panel {
  padding: 22px;
}

.telegram-panel .section-title {
  align-items: flex-start;
}

.telegram-panel h2 {
  margin-bottom: 6px;
}

.telegram-panel p {
  line-height: 1.5;
}

.telegram-connected,
.telegram-connect-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel, #fbfcfb);
}

.telegram-connected > div:first-child,
.telegram-connect-flow > div:first-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.telegram-connected span,
.telegram-connect-flow span,
.telegram-connect-flow small {
  color: var(--muted);
  line-height: 1.45;
}

.telegram-connected .btn-row,
.telegram-connect-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.telegram-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.telegram-settings label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, #fff);
  color: var(--text, #2b333a);
  font-weight: 750;
}

.telegram-settings input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.telegram-panel a.btn {
  text-decoration: none;
}

@media (max-width: 760px) {
  .telegram-connected,
  .telegram-connect-flow {
    display: grid;
  }

  .telegram-connected .btn-row,
  .telegram-connect-actions {
    width: 100%;
    justify-content: stretch;
  }

  .telegram-connected .btn-row .btn,
  .telegram-connect-actions .btn {
    width: 100%;
  }

  .telegram-settings {
    grid-template-columns: 1fr;
  }
}
