*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-mid: #0f172a;
  --bg-deep: #111827;
  --surface: rgba(17, 24, 39, 0.5);
  --surface-solid: #111827;
  --glass: rgba(255, 255, 255, 0.04);
  --ink: #e8edf7;
  --ink2: #94a3b8;
  --muted: #64748b;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --violet: #a78bfa;
  --blue: #60a5fa;
  --accent-glow: rgba(129, 140, 248, 0.42);
  --accent-soft: rgba(129, 140, 248, 0.14);
  --warm-deep: rgba(251, 113, 133, 0.08);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(129, 140, 248, 0.32);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 48px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 28px 88px rgba(0, 0, 0, 0.55);
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-bg: rgba(11, 16, 32, 0.9);
  --btn-ink-bg: rgba(30, 41, 59, 0.92);
  --white: rgba(17, 24, 39, 0.55);
  --lime: #a5b4fc;
  --lime-dark: #818cf8;
  --lime-pale: rgba(129, 140, 248, 0.14);
  --cal-today-pale: rgba(129, 140, 248, 0.12);
  --cal-today-edge: rgba(129, 140, 248, 0.48);
  --cal-today-edge-soft: rgba(129, 140, 248, 0.26);
  --cal-today-col-tint: rgba(129, 140, 248, 0.09);
  --cal-today-badge-bg: rgba(129, 140, 248, 0.2);
  --cal-today-badge-border: rgba(129, 140, 248, 0.38);
  --coral: #fb7185;
  --sky: #38bdf8;
  --danger: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  /*
    Высота списков в портале: верх (~topbar + .main padding) ≈ 10.5–12rem от 100dvh.
    Карточка .item: padding 26px + строки ~50–80px → типично 88–115px; gap .stack 10px
    → на высоте ~520–580px видно примерно 5–7 элементов без прокрутки, дальше — скролл.
  */
  --portal-chrome: 11.5rem;
  --portal-fold-summary-h: 3.35rem;
  --portal-list-max: clamp(320px, calc(100dvh - var(--portal-chrome)), 720px);
  --portal-fold-inner-max: calc(var(--portal-list-max) - var(--portal-fold-summary-h));
  --portal-chat-height: clamp(300px, calc(100dvh - 14rem), min(720px, 82dvh));
  --portal-chat-height-mobile: min(82dvh, calc(100dvh - 9.5rem));
  /* Chrome сайдбара / навигации (тёмная тема по умолчанию) */
  --side-text: #f1f5f9;
  --side-text-muted: rgba(255, 255, 255, 0.45);
  --side-label-color: rgba(255, 255, 255, 0.45);
  --side-input-border: rgba(255, 255, 255, 0.12);
  --side-input-bg: rgba(255, 255, 255, 0.06);
  --side-input-color: #ffffff;
  --side-card-bg: rgba(255, 255, 255, 0.06);
  --side-card-border: rgba(255, 255, 255, 0.1);
  --side-card-text: rgba(255, 255, 255, 0.72);
  --side-nav-fg: rgba(255, 255, 255, 0.62);
  --side-nav-hover-bg: rgba(255, 255, 255, 0.08);
  --side-nav-hover-fg: #ffffff;
  --side-nav-active-bg: rgba(255, 255, 255, 0.1);
  --side-nav-active-fg: #ffffff;
  --brand-sub: rgba(255, 255, 255, 0.38);
  --placeholder: rgba(148, 163, 184, 0.9);
  --bubble-me-bg: var(--sidebar-bg);
  --bubble-me-text: #ffffff;
  --bubble-me-meta: rgba(255, 255, 255, 0.55);
  --focus-ring: 0 0 0 3px var(--accent-soft);
  --panel: #141c2f;
  --bg-soft: #1a2438;
  --portal-shell-max: none;
}
body {
  font-family: "Golos Text", system-ui, sans-serif;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 130% 70% at 50% -15%, rgba(99, 102, 241, 0.14), transparent 58%),
    radial-gradient(ellipse 55% 45% at 100% 20%, rgba(56, 189, 248, 0.06), transparent 52%),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(167, 139, 250, 0.06), transparent 50%),
    radial-gradient(ellipse 40% 35% at 85% 75%, var(--warm-deep), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 45%, var(--bg-deep) 100%);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; }
button { border: 0; }
code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  border-right: 1px solid var(--border);
  color: var(--side-text);
  padding: 24px max(18px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.brand {
  display: inline-block;
  color: var(--accent-hover);
  text-decoration: none;
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 8px;
}
.brand span { color: var(--brand-sub); }
.brand.dark { color: var(--ink); }
.brand.dark span { color: var(--muted); }
.side-copy { color: var(--side-text-muted); font-size: 12px; margin-bottom: 22px; }
.side-label { display: block; color: var(--side-label-color); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.9px; margin-bottom: 8px; }
.account-select {
  width: 100%;
  border: 1px solid var(--side-input-border);
  background: var(--side-input-bg);
  color: var(--side-input-color);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.account-select:hover {
  border-color: color-mix(in srgb, var(--side-input-border) 65%, var(--accent) 35%);
}
.account-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.account-select option { color: var(--ink); }
.account-card {
  background: var(--side-card-bg);
  border: 1px solid var(--side-card-border);
  border-radius: 16px;
  padding: 12px;
  margin: 12px 0 22px;
  color: var(--side-card-text);
  font-size: 12px;
}
.logout-btn {
  width: 100%;
  border: 1px solid var(--side-card-border);
  border-radius: 12px;
  background: var(--side-input-bg);
  color: var(--side-text);
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.logout-btn:hover {
  border-color: color-mix(in srgb, var(--side-card-border) 50%, var(--accent) 50%);
  background: color-mix(in srgb, var(--side-input-bg) 88%, var(--accent-soft));
}
.nav { display: grid; gap: 6px; }
.nav button {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  background: transparent;
  color: var(--side-nav-fg);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.18s var(--ease);
}
.nav button:hover {
  background: var(--side-nav-hover-bg);
  color: var(--side-nav-hover-fg);
}
.nav button.active {
  background: var(--side-nav-active-bg);
  color: var(--side-nav-active-fg);
}
.main {
  position: relative;
  z-index: 1;
  padding: 28px;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  min-width: 0;
}
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.3px; margin-bottom: 8px; }
h1 {
  font-family: "Unbounded", sans-serif;
  font-size: clamp(1.4rem, 2.2vw + 1rem, 1.95rem);
  line-height: 1.12;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.lead { color: var(--muted); max-width: 820px; }
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.top-actions .btn {
  flex-shrink: 0;
}
.view { display: none; }
.view.active { display: block; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: var(--white);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  min-width: 0;
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease), transform 0.22s var(--ease);
}
.panel:hover {
  border-color: color-mix(in srgb, var(--border) 55%, var(--accent) 45%);
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--accent-soft) 70%, transparent);
  transform: translateY(-1px);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}
.panel-head h2 {
  min-width: 0;
  flex: 1 1 auto;
}
.panel-head .link-btn {
  flex-shrink: 0;
}
.panel h2 { font-family: "Unbounded", sans-serif; font-size: 15px; line-height: 1.25; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

details.portal-fold {
  border: 1.5px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  margin-bottom: 12px;
  min-width: 0;
}
details.portal-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
details.portal-fold > summary::-webkit-details-marker { display: none; }
details.portal-fold > summary::after {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-bottom: 2px;
}
details.portal-fold[open] > summary::after {
  transform: rotate(-135deg);
  margin-bottom: -2px;
}
details.portal-fold[open] > summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
details.portal-fold > .portal-fold-inner {
  padding: 0;
}
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner > .panel {
  border: 0;
  border-radius: 0;
  margin: 0;
}
/* Заголовок уже в <summary> свёртки — не дублировать h2 внутри панели при раскрытии */
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner > .panel > h2:first-child {
  display: none;
}
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner > .panel .panel-head h2 {
  display: none;
}
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner > .metric-grid {
  padding: 12px 14px 14px;
}
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner > .overview-role-banner {
  padding: 0 14px 14px;
}
details.portal-fold:not([data-fold-source="dom"]) > .portal-fold-inner > .stack {
  padding: 12px 14px 14px;
}
.grid.two > details.portal-fold,
.grid.three > details.portal-fold {
  min-width: 0;
  min-height: 0;
  align-self: start;
}
.chat-layout > details.portal-fold[data-fold-source="dom"] {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: none;
}
.chat-layout > details.portal-fold[data-fold-source="dom"] > .portal-fold-inner {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-layout > details.portal-fold[data-fold-source="dom"] .thread-panel,
.chat-layout > details.portal-fold[data-fold-source="dom"] .messages-panel {
  flex: 1 1 auto;
  min-height: 0;
}
/* DOM-свёртки: контент полной высоты до лимита, прокрутка одной полосой под summary (без сжатия flex-ом) */
details.portal-fold[data-fold-source="dom"] {
  display: block;
  min-width: 0;
}
details.portal-fold[data-fold-source="dom"] > .portal-fold-inner {
  max-height: var(--portal-fold-inner-max);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
body.portal-compact .main {
  padding-bottom: 40px;
}
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.overview-role-banner { margin-bottom: 18px; }
.overview-role-banner:empty { display: none; }
.overview-role-banner .overview-roster-head { margin-bottom: 12px; }
.overview-role-banner .overview-roster-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.overview-role-banner .overview-roster-actions .btn {
  flex-shrink: 0;
}
.metric {
  background: var(--white);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.metric strong { display: block; font-family: "Unbounded", sans-serif; font-size: 30px; line-height: 1; margin-bottom: 8px; }
.metric span, .muted { color: var(--muted); font-size: 13px; }
.form { display: grid; gap: 11px; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 900; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
.check { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; color: var(--ink2) !important; font-weight: 700 !important; }
.check input { width: auto; }
/* Кнопки: стабильная высота, не растягиваются по высоте строки карточки; ширина по тексту */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--btn-ink-bg);
  color: var(--accent-hover);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.15;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent-soft) 75%, transparent);
}
.btn.primary:hover:not(:disabled) {
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent-glow) 55%, transparent);
}
.btn.ghost {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn.danger { background: rgba(248, 113, 113, 0.12); color: #fecaca; border: 1px solid rgba(248, 113, 113, 0.35); }
.btn.small {
  padding: 7px 12px;
  min-height: 34px;
  height: 34px;
  font-size: 12px;
}
.link-btn {
  background: transparent;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 4px;
  border-radius: 8px;
}
.stack { display: grid; gap: 10px; }
.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  background: var(--white);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.item.surface { background: var(--surface); }
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.item-top > .person,
.item-top > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}
.item-top > .btn,
.item-top > .chip,
.item-top > span.chip {
  flex-shrink: 0;
  align-self: center;
}
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--lime);
  color: var(--ink);
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 900;
}
.avatar.blue { background: var(--blue); color: white; }
.avatar.coral { background: var(--coral); color: white; }
.avatar.sky { background: var(--sky); color: var(--ink); }
.name { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.item-actions .btn {
  align-self: center;
}
.inline-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.inline-controls .btn {
  justify-self: start;
  width: max-content;
  max-width: 100%;
}
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--ink2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.chip.ok { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.chip.warn { background: #FFF7ED; color: #9A3412; border-color: #FED7AA; }
.chip.danger { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.schedule-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }

.schedule-cal-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.schedule-cal-head h2 { margin: 0; }
.schedule-cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.schedule-cal-toggle .btn.active { background: var(--lime); color: var(--ink); border-color: transparent; }
.schedule-cal-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-cal-caption { font-weight: 800; font-size: 14px; min-width: 10em; text-align: center; }
.calendar-mount {
  margin-top: 8px;
  max-height: 68vh;
  overflow-y: auto;
  overflow-x: auto;
  padding-right: 4px;
}
.cal-week-board {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
}
.cal-week-corner {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cal-week-day-head {
  padding: 8px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.cal-week-day-head:last-child {
  border-right: 0;
}
.cal-week-day-name {
  font-size: 11px;
  font-weight: 900;
  color: var(--ink2);
}
.cal-week-day-date {
  font-size: 10px;
  color: var(--muted);
}
.cal-week-day-head--today {
  background: var(--cal-today-pale) !important;
  box-shadow: inset 0 -2px 0 var(--cal-today-edge-soft);
}
.cal-week-day-head--today .cal-week-day-name {
  color: var(--ink);
}
.cal-today-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2F4A1F;
  background: var(--cal-today-badge-bg);
  border: 1px solid var(--cal-today-badge-border);
  line-height: 1.2;
}
.cal-today-badge--compact {
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 8px;
}
/* Прошлые дни — лёгкий синий только у колонок; сегодня — лайм */
.cal-week-day-col.cal-day-past {
  background: rgba(58, 111, 255, 0.028);
}
.cal-week-day-col.cal-day-today {
  background: var(--cal-today-col-tint);
  box-shadow: inset 1px 0 0 var(--cal-today-edge-soft), inset -1px 0 0 var(--cal-today-edge-soft);
}
.cal-week-time-col {
  grid-row: 2;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.cal-week-time-slot {
  height: 96px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.cal-week-time-slot:last-child {
  border-bottom: 0;
}
.cal-week-time-label {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 10px;
  color: var(--muted);
  background: var(--surface);
  padding: 0 4px;
}
.cal-week-day-col {
  grid-row: 2;
  min-height: 0;
  border-right: 1px solid var(--border);
  display: grid;
  grid-template-rows: repeat(var(--cal-week-rows, 17), 96px);
}
.cal-week-day-col:last-child {
  border-right: 0;
}
.cal-week-day-slot {
  border-bottom: 1px solid var(--border);
  padding: 4px;
  min-height: 96px;
  max-height: 96px;
  overflow-y: hidden;
  overflow-x: hidden;
  cursor: pointer;
}
.cal-week-day-slot:hover { background: rgba(58,111,255,0.04); }
.cal-week-day-slot:last-child {
  border-bottom: 0;
}
.cal-week-event {
  position: relative;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(58,111,255,0.2);
  background: rgba(58,111,255,0.07);
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 6px;
  min-width: 0;
}
.cal-week-slot-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 2px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px dashed rgba(58, 111, 255, 0.45);
  background: rgba(58, 111, 255, 0.09);
  font-size: 11px;
  font-weight: 900;
  color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.cal-week-slot-more:hover {
  background: rgba(58, 111, 255, 0.18);
}
.cal-week-event:hover {
  background: rgba(58,111,255,0.18);
}
.cal-week-event.active {
  border-color: var(--blue);
  background: rgba(58,111,255,0.24);
}
.cal-week-event.skipped {
  border-style: dashed;
  opacity: 0.65;
}
.cal-week-event-time {
  font-weight: 900;
  color: var(--ink);
  font-size: 11px;
  flex-shrink: 0;
}
.cal-week-event-title {
  font-weight: 800;
  color: var(--ink2);
  font-size: 11px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-week-event-meta {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  max-width: 42%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-week-event.cal-event-past {
  opacity: 0.88;
  border-style: dashed;
  border-color: rgba(58, 111, 255, 0.22);
  background: rgba(58, 111, 255, 0.04);
}
.cal-week-event.cal-event-past .cal-week-event-title::after {
  content: " · прошло";
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
}

/* Телефон: неделя/месяц списком по дням (без широкой сетки) */
.cal-week-agenda,
.cal-month-agenda {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cal-month-agenda-title {
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
}
.cal-agenda-day {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.cal-agenda-day.cal-day-past {
  background: linear-gradient(180deg, rgba(58, 111, 255, 0.045) 0%, rgba(58, 111, 255, 0.012) 40%, var(--white) 100%);
  border-color: rgba(58, 111, 255, 0.12);
}
.cal-agenda-day.cal-day-today {
  border-color: var(--cal-today-edge-soft);
  box-shadow: 0 0 0 1px var(--cal-today-edge-soft);
  background: linear-gradient(180deg, var(--cal-today-pale) 0%, var(--white) 55%);
}
.cal-agenda-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.cal-agenda-day-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 0;
  flex: 1 1 auto;
}
.cal-agenda-day-head--today {
  background: var(--cal-today-pale);
  border-bottom-color: var(--cal-today-edge-soft);
}
.cal-agenda-dow {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.cal-agenda-day-num {
  color: var(--blue);
  margin-right: 2px;
}
.cal-agenda-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.cal-agenda-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
}
.cal-agenda-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}
.cal-agenda-event {
  width: 100%;
  text-align: left;
  border: 1.5px solid rgba(58, 111, 255, 0.22);
  background: rgba(58, 111, 255, 0.07);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}
.cal-agenda-event:hover {
  background: rgba(58, 111, 255, 0.12);
}
.cal-agenda-event.active {
  border-color: var(--blue);
  background: rgba(58, 111, 255, 0.18);
}
.cal-agenda-event.skipped {
  border-style: dashed;
  opacity: 0.72;
}
.cal-agenda-event-time {
  flex-shrink: 0;
  font-weight: 900;
  font-size: 14px;
  color: var(--ink);
  min-width: 3.2rem;
}
.cal-agenda-event-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.cal-agenda-event-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink2);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cal-agenda-event-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.cal-agenda-event.cal-event-past {
  opacity: 0.9;
  border-style: dashed;
  border-color: rgba(58, 111, 255, 0.22);
  background: rgba(58, 111, 255, 0.04);
}
.cal-agenda-event.cal-event-past .cal-agenda-event-title::after {
  content: " · прошло";
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.schedule-occ-modal[hidden] { display: none !important; }
.schedule-occ-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.schedule-occ-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(6, 10, 20, 0.52);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}
.schedule-occ-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100vw - max(24px, env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px))));
  max-height: min(calc(100dvh - max(24px, env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px))), calc(100vh - 24px));
  margin: max(12px, env(safe-area-inset-top, 0px)) auto max(12px, env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}
.schedule-occ-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.schedule-occ-modal-head h3 {
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
}
.schedule-occ-modal-body {
  overflow-y: auto;
  min-height: 0;
  padding: 12px 14px 16px;
}
.schedule-event-editor-title {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  margin-bottom: 8px;
}
.schedule-event-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.schedule-event-editor-actions--danger {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(248, 113, 113, 0.22);
}
.schedule-occ-modal-gap {
  height: 10px;
}
.cal-month { display: grid; gap: 6px; }
.cal-month-head, .cal-month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-month-head span { font-size: 10px; font-weight: 900; color: var(--muted); text-align: center; text-transform: uppercase; }
.cal-month-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 4px 5px;
  min-height: 220px;
  background: var(--white);
  font-size: 10px;
  cursor: pointer;
}
.cal-month-cell:hover { background: rgba(58,111,255,0.04); }
.cal-month-cell.cal-muted { opacity: 0.45; background: var(--surface); }
.cal-month-cell.cal-day-past:not(.cal-muted) {
  background: rgba(58, 111, 255, 0.035);
}
.cal-month-cell.cal-day-today:not(.cal-muted) {
  background: var(--cal-today-pale);
  box-shadow: inset 0 0 0 1.5px var(--cal-today-edge-soft);
}
.cal-month-cell.cal-day-today:not(.cal-muted) .cal-month-num {
  color: var(--ink);
  font-weight: 900;
}
.cal-month-num { font-weight: 800; margin-bottom: 3px; color: var(--ink2); font-size: 11px; line-height: 1.2; }
.cal-month-events { display: grid; gap: 3px; max-height: none; overflow: hidden; }
.cal-month-event .cal-billing-chip,
.cal-week-event .cal-billing-chip,
.cal-agenda-event .cal-billing-chip {
  flex: 1 1 100%;
  margin-top: 0;
  min-width: 0;
  max-width: 100%;
}
.cal-billing-chip--compact .billing-status-chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}
.cal-month-event--more {
  justify-content: center;
  font-weight: 900;
  color: var(--blue);
  border-style: dashed !important;
  background: rgba(58, 111, 255, 0.08) !important;
  min-height: 26px;
  padding: 4px 6px !important;
}
.cal-overflow-popover[hidden] { display: none !important; }
.cal-overflow-popover {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: grid;
  place-items: center;
  padding: 18px;
}
.cal-overflow-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(6, 10, 20, 0.52);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}
.cal-overflow-popover-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(75vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.cal-overflow-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.cal-overflow-popover-head h3 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
}
.cal-overflow-popover-body {
  padding: 10px 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.cal-overflow-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
}
.cal-overflow-row:hover {
  border-color: var(--sky);
}
.cal-overflow-row-time {
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
  min-width: 3.2rem;
}
.cal-overflow-row-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-overflow-row-title {
  font-weight: 800;
  font-size: 14px;
}
.cal-overflow-row-meta {
  font-size: 12px;
  color: var(--muted);
}
.cal-overflow-row--past {
  opacity: 0.88;
  border-style: dashed;
}
.cal-overflow-row--skipped {
  opacity: 0.65;
  border-style: dashed;
}
.cal-agenda-overflow-btn {
  width: 100%;
  margin-top: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(58, 111, 255, 0.45);
  background: rgba(58, 111, 255, 0.07);
  font-size: 13px;
  font-weight: 900;
  color: var(--blue);
  cursor: pointer;
  text-align: center;
}
.cal-agenda-overflow-btn:hover {
  background: rgba(58, 111, 255, 0.14);
}
.cal-month-event {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(58,111,255,0.2);
  background: rgba(58,111,255,0.08);
  border-radius: 6px;
  padding: 3px 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 3px 5px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--ink2);
  overflow: hidden;
  min-width: 0;
}
.cal-month-event:hover { background: rgba(58,111,255,0.14); }
.cal-month-event.active { border-color: var(--blue); background: rgba(58,111,255,0.2); }
.cal-month-event.skipped { opacity: 0.6; border-style: dashed; }
.cal-month-event.cal-event-past {
  opacity: 0.88;
  border-style: dashed;
  border-color: rgba(58, 111, 255, 0.22);
  background: rgba(58, 111, 255, 0.04);
}
.cal-month-event.cal-event-past .cal-month-event-title::after {
  content: " · прошло";
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
}
.cal-month-event-time { font-weight: 900; color: var(--ink); flex-shrink: 0; }
.cal-month-event-title { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.cal-month-event-student { flex-shrink: 0; max-width: 42%; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-chip {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 5px 5px;
  margin-top: 4px;
  background: var(--surface);
  line-height: 1.25;
}
.occ-chip:first-of-type { margin-top: 2px; }
.occ-chip.occ-muted { opacity: 0.6; border-style: dashed; }
.occ-chip-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 6px;
  min-width: 0;
}
.occ-chip-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}
.occ-chip-time {
  font-weight: 900;
  font-size: 11px;
  color: var(--ink);
  flex-shrink: 0;
}
.occ-chip-flag { display: none; }
.occ-chip-flag.once { display: none; }
.occ-chip-name {
  font-weight: 700;
  font-size: 11px;
  color: var(--ink2);
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.occ-chip-student {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occ-chip-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.occ-chip-line + .occ-chip-meta { display: none; }
.occ-chip-meta + .occ-delete-stack,
.occ-chip-meta + .occ-action-block {
  margin-top: 5px;
}
.occ-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lesson-list-actions { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-direction: column; align-items: flex-start; }
.lesson-list-hint { font-size: 12px !important; display: inline; }
.cal-hint { margin-top: 4px; font-size: 12px !important; }
.lesson-card-title { font-family: "Unbounded", sans-serif; font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.lesson-rename-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.lesson-rename-row input { max-width: min(100%, 340px); flex: 1; min-width: 0; }
.report-lesson { font-size: 13px; color: var(--ink2) !important; font-weight: 600; margin-bottom: 2px; margin-top: 2px; }
.report-form-hint { font-size: 12px !important; font-weight: 600; margin-top: -2px !important; }

/* ——— Отчёты: lesson wrap-up flow ——— */
.report-flow-panel { display: flex; flex-direction: column; gap: 0; }
.report-flow-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.report-flow-head h2 { margin-bottom: 0; }
.report-flow-form { display: flex; flex-direction: column; gap: 14px; }
.report-draft-indicator {
  font-size: 12px;
  font-weight: 700;
  color: var(--lime-dim, #6b8f3a);
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--lime) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, var(--lime));
  animation: report-draft-pop 0.35s ease;
}
@keyframes report-draft-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.report-prev-mount { margin-bottom: 12px; }
.report-prev-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--white) 92%, var(--ink) 2%);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.report-prev-card:hover { border-color: color-mix(in srgb, var(--border) 40%, var(--ink)); }
.report-prev-card summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.report-prev-card summary::-webkit-details-marker { display: none; }
.report-prev-card summary::after {
  content: "▼";
  font-size: 10px;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.report-prev-card[open] summary::after { transform: rotate(-180deg); }
.report-prev-meta { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.report-prev-body {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  max-height: 120px;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--border);
}
.report-prev-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.report-section {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--white);
}
.report-section-head { margin-bottom: 10px; }
.report-section-title {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.report-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.report-chip-row--wrap { gap: 8px; }
.report-chip {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: color-mix(in srgb, var(--white) 85%, var(--ink) 2%);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.report-chip:hover {
  border-color: color-mix(in srgb, var(--border) 30%, var(--ink));
  transform: translateY(-1px);
}
.report-chip:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
.report-chip.active {
  background: var(--lime);
  border-color: transparent;
  color: var(--ink);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 12%, transparent);
}
.report-tags-other {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}
.report-tags-other input {
  min-height: 44px;
  border-radius: 12px;
}
.report-templates-block .report-template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.report-template-btn {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1.5px dashed var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.report-template-btn:hover {
  border-color: var(--ink2);
  background: color-mix(in srgb, var(--lime) 18%, transparent);
}
.report-section--title .report-title-field { margin-bottom: 0; }
.report-section--title input { min-height: 44px; border-radius: 12px; }
.report-section--comment .report-comment-wrap { margin-bottom: 0; }
.report-comment-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 6px;
}
.report-comment-sub { font-size: 11px !important; font-weight: 600; }
.report-comment-textarea {
  width: 100%;
  min-height: 56px;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.report-section--attach .report-attach-field { margin-bottom: 0; }
.report-section--attach input { min-height: 44px; border-radius: 12px; }
.report-submit-row { margin-top: 4px; }
.report-submit-btn {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  font-weight: 900;
  transition: transform 0.12s ease, opacity 0.2s ease;
}
.report-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.report-submit-btn.is-loading { pointer-events: none; }
.report-flow-form.report-success-nudge { animation: report-success-pulse 0.55s ease; }
@keyframes report-success-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lime) 55%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.report-card {
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--white);
  margin-bottom: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.report-card:hover {
  border-color: color-mix(in srgb, var(--border) 35%, var(--ink));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 6%, transparent);
}
.report-card--archive {
  opacity: 0.88;
  background: color-mix(in srgb, var(--white) 88%, var(--muted) 12%);
}
.report-card--archive:hover {
  box-shadow: none;
}
/* Отчёты: колонки по верху, без равной высоты — панель списка не «прыгает» */
#reports .grid.two {
  align-items: start;
}
#reports .report-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
}
#reports .report-list-panel .panel-head {
  flex-shrink: 0;
}
.report-list-root {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.report-list-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}
.report-list-toolbar-wrap {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--white);
  padding-bottom: 4px;
  margin-bottom: -2px;
}
.report-list-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
.report-list-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, var(--white) 30%);
  min-height: 52px;
  box-sizing: border-box;
}
.report-student-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 260px;
  min-width: 0;
}
.report-student-filter-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  min-height: 40px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}
.report-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
}
.report-sort-select {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  min-height: 40px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}
.report-list-toolbar .report-archive-toggle {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}
@media (max-width: 1180px) {
  .report-list-toolbar {
    flex-wrap: wrap;
  }
  .report-list-toolbar .report-archive-toggle {
    margin-left: 0;
    flex: 1 1 100%;
    align-self: stretch;
    justify-content: center;
  }
  .report-student-filter,
  .report-sort-wrap {
    flex: 1 1 calc(50% - 8px);
  }
}
.report-list-section { margin-bottom: 18px; }
.report-list-section-title {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}
.report-month-group {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 8px 10px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.report-month-summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 6px;
  list-style: none;
}
.report-month-summary::-webkit-details-marker { display: none; }
.report-list-cards--archive .report-card { margin-bottom: 8px; }
.schedule-occ-past-hint { margin: 10px 0 12px; line-height: 1.45; }
.meth-course-age { display: inline-block; margin-left: 6px; font-weight: 700; }
.balance-packages { margin: 0 0 8px; padding-left: 0; }
.balance-package-row { padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); font-size: 13px; }
.balance-package-row:last-child { border-bottom: none; }
.report-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.report-card-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  background: color-mix(in srgb, var(--lime) 35%, var(--white));
  border: 1.5px solid var(--border);
}
.report-card-main { flex: 1; min-width: 0; }
.report-card-title-line {
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 4px;
}
.report-card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.report-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.report-preview {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.report-card-actions .btn { min-height: 40px; }
.report-list-main--empty {
  padding: 14px 12px 18px;
  border-radius: 16px;
  border: 1.5px dashed var(--border);
  background: color-mix(in srgb, var(--surface) 40%, var(--white) 60%);
}
.report-list-main--empty .report-list-empty {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
  padding: 12px 8px;
}

@media (max-width: 480px) {
  .report-chip { flex: 1 1 calc(50% - 8px); justify-content: center; text-align: center; }
  .report-template-btn { flex: 1 1 calc(50% - 8px); }
}
.occ-delete-stack { display: grid; gap: 6px; margin-top: 4px; }
.occ-action-block { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; }
.occ-chip .btn.small {
  height: auto;
  min-height: 28px;
  max-height: none;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  white-space: normal;
  line-height: 1.2;
  max-width: 100%;
  text-align: center;
  justify-content: center;
}
.btn-expl { font-size: 9px; font-weight: 600; color: var(--muted); line-height: 1.3; max-width: 100%; }
.schedule-toolbar {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.schedule-subtabs { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-subtab {
  min-height: 46px !important;
  height: 46px !important;
  padding: 11px 18px !important;
  font-size: 15px !important;
  font-weight: 900;
}
.schedule-subtab.active { background: var(--lime); color: var(--ink); border-color: transparent; }
.schedule-toolbar-note {
  width: 100%;
  margin-top: 4px;
}
.schedule-pane { display: none; }
.schedule-pane.active { display: block; }

/* Календарь: отдельный экран, сетка на всю доступную высоту окна */
.view.schedule-calendar-view.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.schedule-calendar-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: calc(100dvh - var(--portal-chrome));
  max-height: calc(100dvh - var(--portal-chrome));
}
.schedule-calendar-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.schedule-calendar-panel .schedule-cal-head,
.schedule-calendar-panel .cal-teacher-hint {
  flex-shrink: 0;
}
.calendar-mount.calendar-mount-full {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  margin-top: 8px;
  overflow: auto;
  overflow-x: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}
.day-col { background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; padding: 12px; min-height: 170px; }
.day-col h3 { font-family: "Unbounded", sans-serif; font-size: 12px; margin-bottom: 10px; }
.slot-card { background: var(--white); border: 1.5px solid rgba(58,111,255,0.16); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.notif-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--coral);
  color: white;
  font-size: 11px;
  font-weight: 900;
  margin-left: 7px;
}
.notification.unread { border-color: var(--coral); background: #FFF7ED; }
.notif-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px 16px;
  align-items: center;
}
.notif-text {
  min-width: 0;
}
.notif-title {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 800;
  line-height: 1.35;
}
.notif-meta { margin-top: 4px; }
.notif-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-recipient { font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--ink2); }
.notification .name { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.chat-proposal-banner { margin-bottom: 12px; padding: 12px 14px; border-radius: 14px; background: var(--lime-pale, #F4FDE0); border: 1.5px solid var(--lime-dark); font-size: 13px; }
.chat-proposal-banner[hidden] { display: none !important; }
.chat-lessons-match {
  flex-shrink: 0;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  max-height: min(200px, 32vh);
  overflow-y: auto;
}
.chat-lessons-match[hidden] { display: none !important; }
.chat-lessons-match-head {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 5px;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chat-lessons-match-empty { margin: 0; font-size: 12px; }
.chat-lesson-row-simple {
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.chat-lesson-row-simple:first-of-type {
  border-top: 0;
  padding-top: 1px;
}
.chat-lesson-row-title {
  font-weight: 800;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 2px;
  line-height: 1.25;
}
.chat-lesson-row-people {
  font-size: 11px;
  color: var(--ink2);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: center;
  line-height: 1.25;
}
.chat-lesson-row-dot {
  color: var(--muted);
  user-select: none;
}
.chat-lesson-row-when {
  font-size: 10px;
  margin-top: 2px;
  line-height: 1.3;
}
.chat-lesson-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.chat-lesson-pair:first-of-type { border-top: 0; padding-top: 2px; }
.chat-lesson-label { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.chat-lesson-detail { display: block; line-height: 1.4; color: var(--ink2); }
.chat-lesson-bridge { align-self: center; color: var(--muted); font-size: 16px; line-height: 1; padding-top: 14px; user-select: none; }
@media (max-width: 720px) {
  .chat-lesson-pair { grid-template-columns: 1fr; }
  .chat-lesson-bridge { display: none; }
}
.chat-proposal-banner .proposal-inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.chat-layout { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 18px; align-items: start; min-width: 0; }
.thread-nav {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
ul.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.thread-list-item {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  min-width: 0;
}
.thread-list-empty,
.messages-empty {
  list-style: none;
}
button.item.thread {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.thread { cursor: pointer; }
.thread-name-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.thread-preview-line {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  max-height: 2.75em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.thread-panel .chat-unread-badge {
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 750;
  opacity: 0.92;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
}
html[data-theme="light"] .thread-panel .chat-unread-badge {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.lesson-series-start-hint {
  margin-top: 4px;
  font-size: 12px;
}
#availabilityForm input[type="date"],
#scheduleQuickCreateForm input[type="date"] {
  margin-top: 4px;
  width: 100%;
  max-width: 220px;
}
.nav .chat-unread-badge {
  margin-left: 6px;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 900;
}
.thread.thread--liaison {
  border-left: 3px solid rgba(255, 92, 58, 0.38);
}
.thread.thread--liaison.active {
  border-left-color: var(--coral);
}
.thread.active { border-color: var(--lime-dark); background: var(--lime-pale, #F4FDE0); }
.thread-panel,
.messages-panel {
  height: var(--portal-chat-height);
  max-height: var(--portal-chat-height);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-layout > details.portal-fold[data-fold-source="dom"] .thread-panel,
.chat-layout > details.portal-fold[data-fold-source="dom"] .messages-panel {
  height: calc(var(--portal-chat-height) - var(--portal-fold-summary-h));
  max-height: calc(var(--portal-chat-height) - var(--portal-fold-summary-h));
}
.messages-panel {
  flex-direction: row;
  align-items: stretch;
  position: relative;
}
.chat-messages-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-panel-head {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.chat-back-btn {
  flex-shrink: 0;
  align-self: center;
}
.chat-panel-head-cluster {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.chat-panel-head-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.chat-quick-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}
.chat-quick-jumps[hidden] {
  display: none !important;
}
.chat-meta-line {
  margin: 0;
}
.chat-meta-line .chip:empty {
  display: none;
}
.btn.chat-context-toggle {
  position: relative;
  flex-shrink: 0;
  align-self: flex-start;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  height: auto;
  min-height: 34px;
  max-width: 10.5rem;
  padding-left: 10px;
  padding-right: 10px;
}
.btn.chat-context-toggle.chat-context-toggle--attention::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--white);
}
.chat-context-drawer {
  flex: 0 0 min(300px, 40vw);
  width: min(300px, 40vw);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1.5px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.chat-context-drawer[hidden] {
  display: none !important;
}
.chat-context-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.chat-context-drawer-title {
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}
.chat-context-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-child-picker-modal[hidden] { display: none !important; }
.chat-child-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
}
.chat-child-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(6, 10, 20, 0.68);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
.chat-child-picker-dialog {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.chat-child-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.chat-child-picker-head h3 {
  margin: 0;
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
}
.chat-child-picker-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.chat-child-picker-item {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 12px;
  min-height: 52px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  cursor: pointer;
}
.chat-child-picker-item:hover {
  border-color: var(--sky);
}
.chat-child-picker-item.active {
  border-color: var(--sky);
  box-shadow: 0 0 0 2px rgba(90, 171, 255, 0.2);
}
.chat-child-picker-item-name {
  font-weight: 700;
  color: var(--ink);
}
.chat-child-picker-item-meta {
  font-size: 12px;
  color: var(--muted);
}
.chat-proposal-banner--drawer {
  margin-bottom: 0;
}
.chat-lessons-match--drawer {
  max-height: none;
  margin-bottom: 0;
  flex: 0 1 auto;
}
@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .panel-head:not(.chat-panel-head) {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .panel-head:not(.chat-panel-head) .link-btn {
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
    min-height: 0;
    width: auto;
    align-self: flex-start;
    box-sizing: border-box;
    border-radius: 8px;
    padding: 6px 4px;
  }
  .panel-head:not(.chat-panel-head) .btn {
    align-self: flex-start;
    width: auto;
    max-width: 100%;
    justify-content: center;
  }
  .schedule-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .schedule-subtabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .schedule-subtab {
    min-height: 36px !important;
    height: auto !important;
    width: 100%;
    max-width: none;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 12px;
  }
  .schedule-cal-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .schedule-cal-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .schedule-cal-toggle,
  .schedule-cal-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
  .schedule-cal-caption {
    min-width: min(12em, 42vw);
    flex: 1 1 auto;
    text-align: center;
  }
  .calendar-mount:not(.calendar-mount-full) {
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    padding-right: 0;
  }
  .schedule-calendar-shell {
    min-height: calc(100dvh - 9rem);
    max-height: calc(100dvh - 9rem);
  }
  .calendar-mount.calendar-mount-full {
    overflow-y: auto;
    overflow-x: auto;
  }
  .chat-context-drawer:not([hidden]) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    width: min(100%, 320px);
    max-height: 100%;
    border-left: 0;
    box-shadow: -10px 0 28px rgba(15, 25, 35, 0.18);
    border-radius: 16px 0 0 16px;
  }
  .cal-overflow-popover {
    align-items: end;
    padding: 10px;
  }
  .cal-overflow-popover-dialog {
    width: 100%;
    max-height: 78vh;
    border-radius: 14px;
  }
  .chat-child-picker-modal {
    align-items: end;
    padding: 10px;
  }
  .chat-child-picker-dialog {
    width: 100%;
    max-height: 82vh;
    border-radius: 14px;
  }
  .chat-child-picker-item {
    min-height: 56px;
  }
}
.thread-panel .thread-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
ul.messages {
  list-style: none;
  margin: 0;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding: 6px 4px 14px 0;
}
li.bubble {
  list-style: none;
  margin: 0;
}
.bubble { max-width: 78%; padding: 11px 13px; border-radius: 14px; background: var(--surface); align-self: flex-start; border: 1px solid transparent; }
.bubble.bubble-parent {
  background: rgba(255, 92, 58, 0.09);
  border-color: rgba(255, 92, 58, 0.22);
}
.bubble.bubble-student {
  background: rgba(56, 201, 224, 0.11);
  border-color: rgba(56, 201, 224, 0.28);
}
.bubble.bubble-teacher {
  background: rgba(58, 111, 255, 0.08);
  border-color: rgba(58, 111, 255, 0.2);
}
.bubble.bubble-admin {
  background: rgba(15, 25, 35, 0.05);
  border-color: var(--border);
}
.bubble.me {
  background: var(--bubble-me-bg);
  color: var(--bubble-me-text);
  align-self: flex-end;
  border-color: transparent;
}
.bubble-meta { display: block; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.02em; margin-bottom: 5px; opacity: 0.92; }
.bubble.me .bubble-meta { color: var(--bubble-me-meta); }
.bubble-text {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
.messages-panel .composer {
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
}
.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: auto;
  align-items: center;
}
.composer input,
.composer .btn {
  min-height: 44px;
}
.composer .btn {
  flex-shrink: 0;
  align-self: center;
}

@media (max-width: 900px) {
  .chat-layout.chat-layout--mobile-conversation > details.portal-fold:first-of-type {
    display: none;
  }
  .chat-layout:not(.chat-layout--mobile-conversation) > details.portal-fold:last-of-type {
    display: none;
  }
  /* Шапка чата и композер: без узкой колонки «Информация» и без одной колонки у формы */
  .messages-panel .chat-panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .messages-panel .chat-back-btn:not([hidden]) {
    align-self: flex-start;
  }
  .messages-panel .chat-panel-head-cluster {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .messages-panel .btn.chat-context-toggle:not([hidden]) {
    max-width: none;
    width: auto;
    align-self: flex-start;
    justify-content: center;
  }
  .messages-panel .composer {
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
  }
  .messages-panel .composer input {
    min-width: 0;
  }
  .messages-panel .composer .btn[type="submit"] {
    min-width: 6.25rem;
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 480px) {
  .bubble { max-width: min(92%, 22rem); }
}

.payment-mount {
  min-height: 220px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 12px;
  margin-bottom: 14px;
}
.payment-mount iframe { width: 100%; min-height: 190px; border: 0; border-radius: 12px; background: var(--white); }
.note { background: #FFF7ED; border: 1.5px solid #FED7AA; color: #9A3412; border-radius: 14px; padding: 13px; font-size: 13px; }
.clean-list { display: grid; gap: 10px; padding-left: 18px; color: var(--ink2); }
.balance-pay-top { margin-bottom: 14px; }
.balance-pay-lead { margin: 0 0 14px; }
.balance-pay-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border-left: 4px solid #F59E0B;
  background: rgba(245, 158, 11, 0.12);
}
.balance-pay-notice-icon {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.95rem;
  line-height: 1;
  color: #92400E;
  background: rgba(245, 158, 11, 0.35);
}
.balance-pay-notice-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
}
.balance-pay-notice-text strong { font-weight: 800; color: #D97706; }
.balance-pay-inline-hint {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.balance-pay-inline-hint strong { font-weight: 700; }
.balance-pay-methods {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 28px;
}
.payment-direct-panel { margin-bottom: 14px; }
.payment-direct-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.payment-direct-label { margin-bottom: 6px; }
.payment-direct-qr-link {
  display: block;
  border-radius: 16px;
  border: 1.5px dashed var(--border);
  background: var(--surface);
  padding: 12px;
}
.payment-direct-qr { max-width: 260px; }
.payment-direct-qr-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: var(--white);
}
.payment-direct-sub { margin-top: 8px; }
.payment-direct-phone { font-size: 18px; font-weight: 900; letter-spacing: 0.01em; }
.payment-direct-note { margin-top: 10px; }

@media (max-width: 920px) {
  .payment-direct-qr { max-width: 320px; }
}
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  background: var(--white);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.login-brand {
  padding: 44px;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.95) 0%, rgba(139, 92, 246, 0.88) 45%, rgba(56, 189, 248, 0.35) 100%);
}
.login-brand h1 { margin-top: 42px; font-size: 38px; color: #f8fafc; }
.login-brand p { max-width: 440px; color: rgba(248, 250, 252, 0.85); }
.login-brand .brand.dark { color: #fff; }
.login-brand .brand.dark span { color: rgba(255, 255, 255, 0.55); }
.login-panel { padding: 44px; display: grid; align-content: center; gap: 18px; }
.login-panel .form .btn,
.login-panel > .btn {
  width: 100%;
  height: auto;
  min-height: 44px;
  max-height: none;
  justify-content: center;
  box-sizing: border-box;
}
.login-panel > .btn {
  text-align: center;
}
.btn.btn-block {
  width: 100%;
  height: auto;
  min-height: 44px;
  max-height: none;
  justify-content: center;
}
@media (max-width: 1060px) {
  .app { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    min-height: 0;
    background: color-mix(in srgb, var(--sidebar-bg) 94%, var(--surface) 6%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .side .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .side .nav button {
    text-align: center;
    font-size: 13px;
    padding: 10px 10px;
    line-height: 1.25;
  }
  .grid.two, .grid.three, .chat-layout, .support-admin-layout { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-week-board {
    min-width: 980px;
  }
  .calendar-mount {
    overflow-x: auto;
  }
  .thread-panel,
  .messages-panel {
    height: clamp(300px, min(58dvh, calc(100dvh - 13rem)), var(--portal-chat-height));
    max-height: min(var(--portal-chat-height), calc(100dvh - 11rem));
  }
  .chat-layout > details.portal-fold[data-fold-source="dom"] .thread-panel,
  .chat-layout > details.portal-fold[data-fold-source="dom"] .messages-panel {
    height: calc(clamp(300px, min(58dvh, calc(100dvh - 13rem)), var(--portal-chat-height)) - var(--portal-fold-summary-h));
    max-height: calc(min(var(--portal-chat-height), calc(100dvh - 11rem)) - var(--portal-fold-summary-h));
  }
  .thread-panel .thread-list,
  .messages {
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }
  @media (max-width: 900px) {
    .chat-layout.chat-layout--mobile-conversation .messages-panel,
    .chat-layout:not(.chat-layout--mobile-conversation) .thread-panel {
      height: var(--portal-chat-height-mobile);
      max-height: min(720px, calc(100dvh - 8.5rem));
    }
    .chat-layout.chat-layout--mobile-conversation > details.portal-fold[data-fold-source="dom"] .messages-panel,
    .chat-layout:not(.chat-layout--mobile-conversation) > details.portal-fold[data-fold-source="dom"] .thread-panel {
      height: calc(var(--portal-chat-height-mobile) - var(--portal-fold-summary-h));
      max-height: calc(min(720px, calc(100dvh - 8.5rem)) - var(--portal-fold-summary-h));
    }
  }
}
@media (max-width: 620px) {
  .main {
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
  .panel { padding: 14px 16px; }
  .lead { max-width: 100%; }
  .grid.four,
  .metric-grid { grid-template-columns: 1fr; }
  .form-row, .inline-controls, .schedule-grid { grid-template-columns: 1fr; }
  .cal-week-board {
    min-width: 860px;
  }
  .cal-month-rows { overflow-x: auto; }
  .cal-month-head, .cal-month-row { min-width: 520px; }
  .item-top { flex-direction: column; align-items: stretch; }
  .item-top > .btn,
  .item-top > .chip {
    align-self: flex-start;
  }
  .item-actions {
    justify-content: flex-start;
    gap: 6px;
  }
  .notif-main {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .notif-actions {
    width: auto;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .lesson-rename-row {
    flex-direction: column;
    align-items: stretch;
  }
  .lesson-rename-row input {
    max-width: none;
    width: 100%;
  }
  .schedule-event-editor-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .schedule-event-editor-actions .btn {
    width: auto;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }
  /* Компактные кнопки на телефоне */
  .btn:not(.small) {
    min-height: 36px;
    height: auto;
    padding: 8px 14px;
    font-size: 13px;
  }
  .btn.small {
    min-height: 32px;
    height: 32px;
    padding: 5px 10px;
    font-size: 11px;
  }
  .link-btn {
    padding: 4px 2px;
    font-size: 13px;
  }
  .composer input,
  .composer .btn {
    min-height: 38px;
  }
  .messages-panel .composer .btn[type="submit"] {
    min-width: 5.5rem;
    padding-left: 12px;
    padding-right: 12px;
  }
  /* Вход / регистрация */
  .login-body {
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px));
  }
  .login-shell { border-radius: 18px; }
  .login-brand,
  .login-panel { padding: 22px 18px; }
  .login-brand h1 {
    margin-top: 20px;
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  }
  .login-panel .form .btn,
  .login-panel > .btn,
  .btn.btn-block {
    min-height: 38px;
  }
  /* Боковая навигация портала — сетка 2 колонки, меньше отступы */
  .side {
    padding: 16px max(14px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  }
  .side .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .side .nav button {
    padding: 9px 8px;
    font-size: 12px;
    text-align: center;
    line-height: 1.25;
  }
  .logout-btn {
    padding: 9px 12px;
    font-size: 13px;
  }
  .topbar h1 {
    font-size: clamp(1.2rem, 5vw, 1.45rem);
  }
  .top-actions {
    gap: 6px;
  }
  .metric strong {
    font-size: 24px;
  }
}

/* —— Тёмная тема: токены по умолчанию в :root; ниже — уточнения компонентов —— */
html[data-theme="dark"] .cal-today-badge {
  color: #e0e7ff;
}
html[data-theme="dark"] .schedule-cal-toggle .btn.active,
html[data-theme="dark"] .schedule-subtab.active {
  color: #fff;
}
html[data-theme="dark"] .avatar {
  color: #0f172a;
}
html[data-theme="dark"] .avatar.blue,
html[data-theme="dark"] .avatar.coral {
  color: white;
}
html[data-theme="dark"] .avatar.sky {
  color: #0f1923;
}
html[data-theme="dark"] .btn.danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}
html[data-theme="dark"] .chip.ok {
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
}
html[data-theme="dark"] .chip.warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
}
html[data-theme="dark"] .chip.danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}
html[data-theme="dark"] .note {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}
html[data-theme="dark"] .notification.unread {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.4);
}
html[data-theme="dark"] .chat-proposal-banner {
  background: rgba(200, 242, 58, 0.1);
  border-color: rgba(200, 242, 58, 0.35);
  color: var(--ink);
}
html[data-theme="dark"] .thread.active {
  background: rgba(200, 242, 58, 0.08);
  border-color: var(--lime-dark);
}
html[data-theme="dark"] .bubble.bubble-parent {
  background: rgba(255, 143, 120, 0.12);
  border-color: rgba(255, 143, 120, 0.32);
}
html[data-theme="dark"] .bubble.bubble-student {
  background: rgba(93, 213, 235, 0.12);
  border-color: rgba(93, 213, 235, 0.32);
}
html[data-theme="dark"] .bubble.bubble-teacher {
  background: rgba(124, 168, 255, 0.12);
  border-color: rgba(124, 168, 255, 0.28);
}
html[data-theme="dark"] .bubble.bubble-admin {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}
html[data-theme="dark"] .slot-card {
  border-color: rgba(124, 168, 255, 0.22);
}
html[data-theme="dark"] .cal-week-board,
html[data-theme="dark"] .cal-month {
  background: var(--white);
}
html[data-theme="dark"] .schedule-occ-modal-backdrop {
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(10px) saturate(1.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
}
html[data-theme="dark"] .chat-child-picker-backdrop {
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(10px) saturate(1.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
}
html[data-theme="dark"] .cal-overflow-popover-backdrop {
  background: rgba(4, 6, 12, 0.55);
  backdrop-filter: blur(10px) saturate(1.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
}
html[data-theme="dark"] .portal-password-modal-backdrop {
  background: rgba(0, 0, 0, 0.62);
}
html[data-theme="dark"] .schedule-occ-modal-dialog,
html[data-theme="dark"] .cal-overflow-popover-dialog,
html[data-theme="dark"] .chat-child-picker-dialog,
html[data-theme="dark"] .portal-password-modal-dialog,
html[data-theme="dark"] .family-card {
  /* Непрозрачная панель поверх blur-backdrop: var(--surface-solid) в связке с полупрозрачными токенами давала «мытый» UI */
  background: var(--panel);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.45);
  color: var(--ink);
}
html[data-theme="dark"] .schedule-occ-modal {
  isolation: isolate;
}
html[data-theme="dark"] .theme-toggle-login {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

.theme-toggle-login {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 50;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
html[data-theme="dark"] .login-body .theme-toggle-login {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

/* Внутренние заметки (staff-only): лента времени */
.internal-notes-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.internal-notes-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink2);
}
.internal-note-form textarea {
  min-height: 56px;
  resize: vertical;
}
.internal-note-label {
  display: block;
  margin-bottom: 8px;
}
.internal-note-label textarea {
  margin-top: 6px;
  width: 100%;
}
.timeline {
  margin: 12px 0 14px;
  padding-left: 6px;
  border-left: 2px solid rgba(58, 111, 255, 0.35);
}
.timeline-item {
  position: relative;
  padding: 0 0 14px 18px;
}
.timeline-dot {
  position: absolute;
  left: -11px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px rgba(58, 111, 255, 0.35);
}
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.timeline-meta .btn {
  margin-left: auto;
}
.timeline-body {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.overview-student-with-notes .internal-notes-panel {
  width: 100%;
}
html[data-theme="dark"] .timeline {
  border-left-color: rgba(124, 168, 255, 0.45);
}
html[data-theme="dark"] .timeline-dot {
  border-color: var(--sidebar-bg);
  background: var(--sky);
  box-shadow: 0 0 0 1px rgba(93, 213, 235, 0.45);
}
html[data-theme="dark"] .timeline-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

/* —— Светлая тема: отдельная calm edtech палитра (не инверсия dark) —— */
html[data-theme="light"] {
  color-scheme: light;
  /* Фон и поверхности */
  --bg: #f3f5fb;
  --bg-mid: #eef1f8;
  --bg-deep: #e8ecf6;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #f4f6fc;
  --surface-elevated: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.88);
  --glass: rgba(255, 255, 255, 0.78);
  /* Текст */
  --ink: #1a1f2e;
  --ink2: #3d4556;
  --muted: #5c6478;
  --text: #1a1f2e;
  --text-secondary: #4a5368;
  --panel: #ffffff;
  --bg-soft: #f4f6fc;
  /* Акцент: мягкий индиго / лаванда */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --violet: #7c73e6;
  --blue: #4f6ae8;
  --accent-glow: rgba(99, 102, 241, 0.28);
  --accent-soft: rgba(99, 102, 241, 0.12);
  --warm-deep: rgba(244, 114, 182, 0.06);
  --border: rgba(30, 40, 60, 0.08);
  --border-soft: rgba(30, 40, 60, 0.05);
  --border-strong: rgba(99, 102, 241, 0.22);
  --shadow-sm: 0 1px 2px rgba(30, 40, 60, 0.04), 0 4px 16px rgba(30, 40, 60, 0.06);
  --shadow-md: 0 4px 8px rgba(30, 40, 60, 0.04), 0 12px 40px rgba(49, 46, 129, 0.09);
  --shadow-lg: 0 8px 24px rgba(30, 40, 60, 0.06), 0 28px 64px rgba(49, 46, 129, 0.12);
  /* Сайдбар glass */
  --sidebar-bg: rgba(255, 255, 255, 0.78);
  --btn-ink-bg: rgba(99, 102, 241, 0.08);
  --white: var(--card-bg);
  /* «Сегодня» / выбранное — лавандовые токены (совместимость с --lime в разметке) */
  --lime: #e8eafd;
  --lime-dark: #6366f1;
  --lime-pale: rgba(99, 102, 241, 0.11);
  --cal-today-pale: rgba(99, 102, 241, 0.07);
  --cal-today-edge: rgba(99, 102, 241, 0.38);
  --cal-today-edge-soft: rgba(99, 102, 241, 0.2);
  --cal-today-col-tint: rgba(99, 102, 241, 0.05);
  --cal-today-badge-bg: rgba(99, 102, 241, 0.12);
  --cal-today-badge-border: rgba(99, 102, 241, 0.32);
  --coral: #e11d48;
  --sky: #0ea5e9;
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.09);
  --danger-border: rgba(185, 28, 28, 0.22);
  --ok: #15803d;
  --warn: #b45309;
  /* Chrome сайдбара */
  --side-text: #1e2433;
  --side-text-muted: rgba(30, 36, 51, 0.58);
  --side-label-color: rgba(30, 36, 51, 0.48);
  --side-input-border: rgba(30, 40, 60, 0.12);
  --side-input-bg: rgba(255, 255, 255, 0.92);
  --side-input-color: var(--ink);
  --side-card-bg: rgba(99, 102, 241, 0.06);
  --side-card-border: rgba(30, 40, 60, 0.1);
  --side-card-text: rgba(30, 36, 51, 0.75);
  --side-nav-fg: rgba(30, 36, 51, 0.65);
  --side-nav-hover-bg: rgba(99, 102, 241, 0.09);
  --side-nav-hover-fg: #1e2433;
  --side-nav-active-bg: rgba(99, 102, 241, 0.14);
  --side-nav-active-fg: #3730a3;
  --brand-sub: rgba(30, 36, 51, 0.42);
  --placeholder: rgba(30, 40, 60, 0.38);
  --bubble-me-bg: linear-gradient(145deg, #6366f1 0%, #7c73e6 55%, #8b87eb 100%);
  --bubble-me-text: #ffffff;
  --bubble-me-meta: rgba(255, 255, 255, 0.78);
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
html[data-theme="light"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 70% at 50% -8%, rgba(99, 102, 241, 0.09), transparent 52%),
    radial-gradient(ellipse 55% 50% at 100% 15%, rgba(124, 115, 230, 0.06), transparent 50%),
    radial-gradient(ellipse 45% 40% at 0% 85%, rgba(14, 165, 233, 0.05), transparent 48%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 48%, var(--bg-deep) 100%);
}
html[data-theme="light"] body::before {
  opacity: 0.022;
}
html[data-theme="light"] .brand {
  color: var(--accent);
}
html[data-theme="light"] .brand span {
  color: var(--brand-sub);
}
html[data-theme="light"] .side {
  color: var(--side-text);
  border-right-color: var(--border);
  box-shadow: 4px 0 32px rgba(30, 40, 60, 0.04);
}
html[data-theme="light"] .btn {
  color: var(--accent-hover);
  border-color: var(--border);
  background: var(--btn-ink-bg);
}
html[data-theme="light"] .btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: rgba(99, 102, 241, 0.12);
}
html[data-theme="light"] .btn.primary {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 48%, #5b52d7 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.22), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}
html[data-theme="light"] .btn.primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.32), 0 1px 0 rgba(255, 255, 255, 0.4) inset;
  transform: translateY(-1px);
}
html[data-theme="light"] .btn.ghost {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  border-color: var(--border);
}
html[data-theme="light"] .btn.ghost:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.07);
  border-color: color-mix(in srgb, var(--border) 40%, var(--accent) 60%);
}
html[data-theme="light"] .btn:disabled {
  opacity: 0.42;
}
html[data-theme="light"] .btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}
html[data-theme="light"] .btn.danger:hover:not(:disabled) {
  background: rgba(185, 28, 28, 0.12);
  border-color: rgba(185, 28, 28, 0.32);
}
html[data-theme="light"] .login-brand {
  background: linear-gradient(145deg, #818cf8 0%, #6366f1 42%, #4f46e5 100%);
}
html[data-theme="light"] .login-brand h1,
html[data-theme="light"] .login-brand p,
html[data-theme="light"] .login-brand .brand.dark,
html[data-theme="light"] .login-brand .brand.dark span {
  color: #f8fafc;
}
html[data-theme="light"] .login-brand .brand.dark span {
  color: rgba(248, 250, 252, 0.72);
}
html[data-theme="light"] .login-brand p {
  color: rgba(248, 250, 252, 0.88);
}
html[data-theme="light"] .login-shell {
  background: var(--surface-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}
html[data-theme="light"] .login-panel {
  background: var(--surface-elevated);
}
html[data-theme="light"] .theme-toggle-login {
  border-color: rgba(30, 40, 60, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .theme-toggle-login:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}
html[data-theme="light"] .panel,
html[data-theme="light"] .metric,
html[data-theme="light"] .item,
html[data-theme="light"] details.portal-fold {
  background: var(--card-bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
}
html[data-theme="light"] .panel:hover,
html[data-theme="light"] .metric:hover {
  box-shadow: var(--shadow-md);
}
html[data-theme="light"] .item:hover {
  border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(99, 102, 241, 0.06);
}
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}
html[data-theme="light"] input:hover,
html[data-theme="light"] select:hover,
html[data-theme="light"] textarea:hover {
  border-color: rgba(30, 40, 60, 0.12);
}
html[data-theme="light"] .schedule-occ-modal-backdrop,
html[data-theme="light"] .chat-child-picker-backdrop,
html[data-theme="light"] .cal-overflow-popover-backdrop,
html[data-theme="light"] .portal-password-modal-backdrop,
html[data-theme="light"] .family-overlay {
  background: rgba(22, 28, 42, 0.42);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
html[data-theme="light"] .schedule-occ-modal-dialog,
html[data-theme="light"] .cal-overflow-popover-dialog,
html[data-theme="light"] .chat-child-picker-dialog,
html[data-theme="light"] .portal-password-modal-dialog,
html[data-theme="light"] .family-card {
  background: #ffffff;
  border-color: rgba(30, 40, 60, 0.12);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.06);
  color: var(--ink);
}
html[data-theme="light"] .family-tile {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--ink);
}
html[data-theme="light"] .family-tile:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--accent);
}
html[data-theme="light"] .family-input {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--ink);
  letter-spacing: 0.15em;
}
html[data-theme="light"] .family-btn-ghost {
  color: var(--ink2);
  background: var(--surface-elevated);
  border-color: var(--border);
}
html[data-theme="light"] .family-link {
  color: var(--muted);
}
html[data-theme="light"] .family-toast {
  background: var(--panel);
  border-color: var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
html[data-theme="light"] .chat-child-picker-item.active {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22);
}
html[data-theme="light"] .cal-week-board,
html[data-theme="light"] .cal-month {
  background: var(--card-bg);
  border-color: var(--border);
}
html[data-theme="light"] .cal-week-corner,
html[data-theme="light"] .cal-week-day-head,
html[data-theme="light"] .cal-week-time-col {
  background: rgba(99, 102, 241, 0.04);
}
html[data-theme="light"] .cal-week-day-slot:hover {
  background: rgba(99, 102, 241, 0.05);
}
html[data-theme="light"] .cal-today-badge {
  color: #4338ca;
}
html[data-theme="light"] .schedule-cal-toggle .btn.active,
html[data-theme="light"] .schedule-subtab.active {
  color: var(--ink);
  font-weight: 900;
}
html[data-theme="light"] .chip {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--border);
  color: var(--text-secondary);
}
html[data-theme="light"] .chip.ok {
  background: rgba(21, 128, 61, 0.08);
  color: #166534;
  border-color: rgba(21, 128, 61, 0.22);
}
html[data-theme="light"] .chip.warn {
  background: rgba(180, 83, 9, 0.08);
  color: #9a3412;
  border-color: rgba(180, 83, 9, 0.2);
}
html[data-theme="light"] .chip.danger {
  background: rgba(185, 28, 28, 0.08);
  color: #991b1b;
  border-color: rgba(185, 28, 28, 0.22);
}
html[data-theme="light"] .thread.active {
  border-color: rgba(99, 102, 241, 0.35);
  background: var(--lime-pale);
}
html[data-theme="light"] .chat-proposal-banner {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.28);
  color: var(--ink);
}
html[data-theme="light"] .notification.unread {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(225, 29, 72, 0.28);
}
html[data-theme="light"] .note {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(180, 83, 9, 0.22);
  color: #92400e;
}
html[data-theme="light"] .report-chip:focus-visible {
  outline-color: var(--accent);
}
html[data-theme="light"] .report-chip.active {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
html[data-theme="light"] .report-template-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}
html[data-theme="light"] .slot-card {
  border-color: rgba(99, 102, 241, 0.18);
}
html[data-theme="light"] .timeline {
  border-left-color: rgba(99, 102, 241, 0.28);
}
html[data-theme="light"] .timeline-dot {
  border-color: var(--surface-elevated);
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}
html[data-theme="light"] .timeline-card {
  background: var(--card-bg);
  border-color: var(--border);
}
html[data-theme="light"] .avatar {
  color: #1e1b4b;
}
html[data-theme="light"] .avatar.blue,
html[data-theme="light"] .avatar.coral {
  color: #ffffff;
}
html[data-theme="light"] .avatar.sky {
  color: #0c4a6e;
}
html[data-theme="light"] code {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--border);
}

/* Домашнее задание — спокойный edtech-UX */
.homework-panel {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(129, 140, 248, 0.06);
}
.homework-panel--teacher-edit {
  margin-top: 16px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--panel) 92%, rgba(129, 140, 248, 0.12));
}
.homework-teacher-head .homework-panel-title {
  margin-bottom: 4px;
}
.homework-field-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.hw-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 13px;
}
.hw-label--row {
  flex-wrap: wrap;
  flex-direction: row;
  align-items: baseline;
  gap: 8px 12px;
}
.hw-label--row .hw-label-text {
  min-width: 6.5rem;
}
.hw-label--row input {
  flex: 1 1 180px;
  min-width: 0;
}
.hw-label-text {
  font-weight: 600;
  color: var(--ink2);
  font-size: 12px;
  letter-spacing: 0.01em;
}
.hw-optional {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.form--lesson-modal .form-row--tight {
  gap: 12px;
  margin-top: 4px;
}
.schedule-occ-modal-summary {
  line-height: 1.35;
}
.schedule-save-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.schedule-save-hint {
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 8px;
}
.schedule-save-hint--secondary {
  margin-top: 10px;
  margin-bottom: 0;
  opacity: 0.92;
}
.schedule-save-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.homework-card {
  margin: 14px 0 0;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--panel) 88%, rgba(52, 211, 153, 0.08));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.homework-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.homework-card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink2);
  opacity: 0.85;
}
.homework-soft-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.18);
  color: var(--ink);
}
.homework-card-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.homework-card-body {
  margin: 0 0 12px;
  line-height: 1.5;
  font-size: 14px;
  white-space: pre-wrap;
  color: color-mix(in srgb, var(--ink) 92%, var(--ink2));
}
.homework-card-empty {
  margin: 0;
  line-height: 1.45;
}
.homework-progress-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.homework-pill {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--border) 90%, var(--ink2));
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.homework-pill:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--panel) 88%, rgba(129, 140, 248, 0.12));
}
.homework-pill:disabled {
  opacity: 0.55;
  cursor: wait;
}
.homework-pill--active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.homework-progress-hint {
  font-size: 12px;
  margin: 8px 0 0;
}
.homework-open-link {
  margin: 0;
  display: inline-flex;
  width: fit-content;
}
.homework-panel--family {
  background: rgba(52, 211, 153, 0.07);
}
.homework-panel-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.homework-teacher-hint,
.homework-due-hint {
  font-size: 12px;
  margin: 6px 0 0;
}
.homework-link-wrap {
  margin: 0 0 8px;
}
.homework-link {
  font-weight: 600;
}
.homework-important-check {
  margin-top: 4px;
  font-size: 13px;
}
.occ-family-sub {
  margin-bottom: 10px;
  font-size: 13px;
}
.occ-family-actions {
  flex-wrap: wrap;
}
.homework-teaser {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  color: var(--ink2);
}
.homework-teaser--empty {
  font-weight: 500;
}
.overview-upcoming-card .homework-teaser {
  margin-top: 6px;
}

/* Вкладка «Что попробовать», обзор, отчёт + ДЗ */
.overview-homework-wrap {
  margin-bottom: 16px;
}
.overview-hw-panel {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--panel) 94%, rgba(129, 140, 248, 0.06));
}
.overview-hw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.overview-hw-mini {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.overview-hw-mini:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--panel) 92%, rgba(129, 140, 248, 0.06));
}
.overview-hw-mini-title {
  font-weight: 650;
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.overview-hw-mini-meta {
  font-size: 12px;
  margin-bottom: 8px;
}
.overview-hw-mini-link {
  font-size: 13px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
.homework-hub-panel {
  max-width: 920px;
}
.homework-hub-lead {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
}
.homework-hub-list .empty {
  padding: 24px 16px;
  text-align: center;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent);
}
.homework-hub-item {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--panel) 93%, rgba(52, 211, 153, 0.05));
  margin-bottom: 12px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.homework-hub-item:hover {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}
.homework-hub-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.homework-hub-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.homework-hub-item-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.homework-hub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.homework-hub-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, rgba(129, 140, 248, 0.15));
  color: var(--ink2);
}
.homework-hub-status--done {
  background: color-mix(in srgb, var(--panel) 85%, rgba(52, 211, 153, 0.22));
}
.homework-hub-status--progress {
  background: color-mix(in srgb, var(--panel) 88%, rgba(251, 191, 36, 0.18));
}
.homework-hub-context {
  font-size: 13px;
  margin: 0 0 8px;
  line-height: 1.4;
}
.homework-hub-desc {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: color-mix(in srgb, var(--ink) 90%, var(--ink2));
}
.homework-hub-meta-row {
  margin-bottom: 10px;
  font-size: 13px;
}
.homework-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.homework-progress-row--hub {
  margin-top: 0;
}
.occ-family-modal-head {
  margin-bottom: 12px;
}
.occ-family-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.3;
}
.occ-family-teacher {
  margin: 4px 0 0;
  font-size: 13px;
}
.report-hw-inline {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
}
.report-section-sub {
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}
.report-hw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-top: 10px;
}
@media (max-width: 640px) {
  .report-hw-grid {
    grid-template-columns: 1fr;
  }
}
.report-hw-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 13px;
}
.report-hw-field--wide {
  grid-column: 1 / -1;
}
.report-hw-label {
  font-weight: 600;
  color: var(--ink2);
  font-size: 12px;
}
.report-hw-field input,
.report-hw-field textarea,
.report-hw-field select {
  width: 100%;
}
.overview-student-quick-actions {
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 520px) {
  .cal-month-cell {
    min-height: min(200px, 48vw);
    padding: 3px;
  }
  .cal-week-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* —— Баланс занятий (edtech, без «банка») —— */
.balance-intro-copy {
  max-width: 52rem;
  line-height: 1.5;
  margin: 0;
}
.balance-mount {
  margin-top: 8px;
}
.balance-page.calm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.balance-panel.calm-card {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  padding: 18px 20px;
}
.balance-child-name {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 650;
}
.balance-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 16px;
  margin: 12px 0;
}
.balance-metrics--compact {
  margin-top: 8px;
}
.balance-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 88%, var(--accent) 4%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.balance-metric--emph {
  grid-column: 1 / -1;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--bg));
}
.balance-metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.balance-metric-label {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.balance-last {
  margin: 8px 0 0;
}
.balance-sep {
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  margin: 18px 0 14px;
}
.balance-sub {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
}
.balance-soft-warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink2);
  background: color-mix(in srgb, var(--warn-soft, rgba(234, 179, 8, 0.12)) 100%, transparent);
  border: 1px solid color-mix(in srgb, rgba(234, 179, 8, 0.35) 70%, var(--border));
}
.balance-history-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}
.balance-history-actions {
  flex-shrink: 0;
}
.balance-history-slider {
  position: relative;
  margin-top: 4px;
}
.balance-history-slider--nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.balance-history-slider--nav .balance-history-track {
  grid-column: 2;
}
.balance-history-slider--nav .balance-history-slider-btn--prev {
  grid-column: 1;
  grid-row: 1;
}
.balance-history-slider--nav .balance-history-slider-btn--next {
  grid-column: 3;
  grid-row: 1;
}
.balance-history-slider-hint {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  text-align: center;
}
.balance-history-slider-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}
.balance-history-slider-btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--glass));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.balance-history-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
}
.balance-history-track::-webkit-scrollbar {
  height: 6px;
}
.balance-history-track::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 999px;
}
.balance-history-card {
  flex: 0 0 min(272px, calc(100vw - 7rem));
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--glass) 90%, transparent);
  min-height: 148px;
}
.balance-history-card-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
}
.balance-history-card-meta {
  line-height: 1.35;
}
.balance-history-card-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.balance-history-card-hint {
  margin: 0;
  line-height: 1.35;
}
.balance-history-card-actions {
  margin-top: auto;
  padding-top: 4px;
}
.balance-history-card-actions .btn {
  width: 100%;
  justify-content: center;
}
@media (max-width: 520px) {
  .balance-history-slider--nav {
    grid-template-columns: 1fr;
  }
  .balance-history-slider--nav .balance-history-slider-btn--prev,
  .balance-history-slider--nav .balance-history-slider-btn--next {
    display: none;
  }
  .balance-history-slider--nav .balance-history-track {
    grid-column: 1;
  }
}
.balance-topup-stub {
  margin-top: 12px;
}
.balance-family-disc-hint {
  margin: 10px 0 0;
}
.balance-pace-lead {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink2);
}
.balance-suggest {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  background: color-mix(in srgb, var(--sky) 12%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--sky) 35%, var(--border));
}
.balance-suggest--warn {
  background: color-mix(in srgb, var(--coral) 10%, var(--bg));
  border-color: color-mix(in srgb, var(--coral) 32%, var(--border));
}
.balance-subscribe-block {
  margin-top: 4px;
}
.balance-subscribe-lead {
  margin: 0 0 14px;
  max-width: 44rem;
}
.balance-subcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
}
.balance-subcard {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--white) 92%, var(--bg));
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.balance-subcard-head {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.balance-subcard-lessons {
  font-size: 13px;
  color: var(--ink2);
}
.balance-subcard-disc {
  font-size: 12px;
  font-weight: 650;
  color: var(--lime-dark, #3d5c27);
}
.balance-subcard-disc--muted {
  color: var(--muted);
  font-weight: 600;
}
.balance-subcard-price {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.balance-subcard-cur {
  font-size: 0.85em;
  font-weight: 700;
  color: var(--muted);
}
.balance-subcard-actions {
  margin-top: auto;
  padding-top: 8px;
}
.balance-subcard-pay {
  width: 100%;
  justify-content: center;
}
.balance-subcard-student-hint {
  margin: 0;
}
@media (max-width: 520px) {
  .balance-subcard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .balance-subcard-price {
    font-size: 1.1rem;
  }
}
.people-admin-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
  align-items: end;
}
.people-payout-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 650;
}
.people-payout-field--wide {
  grid-column: 1 / -1;
}
.people-payout-field input {
  min-height: 40px;
}
.admin-subscription-panel {
  margin-bottom: 16px;
}
.admin-subscription-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.admin-subscription-price input {
  margin-left: 8px;
  min-width: 6rem;
}
.admin-subscription-grid {
  display: grid;
  grid-template-columns: max-content 4.5rem max-content;
  column-gap: 10px;
  row-gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 100%;
}
.admin-subscription-row {
  display: contents;
  font-size: 13px;
}
.admin-subscription-row > span:first-child {
  text-align: right;
  white-space: nowrap;
}
.admin-subscription-row input {
  width: 100%;
  min-height: 40px;
  box-sizing: border-box;
}
.balance-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}
.balance-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
}
.balance-note {
  margin: 0 0 14px;
  max-width: 40rem;
}
.report-credit-line {
  margin: 6px 0 4px;
}
.credit-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.credit-chip--pending {
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
  color: var(--accent-hover);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.credit-chip--insufficient_credits {
  background: color-mix(in srgb, rgba(239, 68, 68, 0.1) 100%, transparent);
  color: #b91c1c;
  border: 1px solid color-mix(in srgb, rgba(239, 68, 68, 0.35) 80%, var(--border));
}
.billing-risk-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, rgba(239, 68, 68, 0.35) 70%, var(--border));
  background: color-mix(in srgb, rgba(239, 68, 68, 0.06) 100%, var(--panel));
}
.billing-risk-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.billing-risk-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.billing-risk-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.billing-risk-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.billing-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.billing-status-chip--ok {
  color: #16a34a;
  background: color-mix(in srgb, rgba(34, 197, 94, 0.12) 100%, transparent);
}
.billing-status-chip--low {
  color: #b45309;
  background: color-mix(in srgb, rgba(245, 158, 11, 0.12) 100%, transparent);
}
.billing-status-chip--stop {
  color: #b91c1c;
  background: color-mix(in srgb, rgba(239, 68, 68, 0.1) 100%, transparent);
}
.billing-status-chip--compact {
  font-size: 9px;
  padding: 1px 6px;
  line-height: 1.25;
}
.admin-credit-risk {
  margin: 6px 0 0;
}
.cal-billing-chip {
  display: block;
  margin-top: 4px;
}
.cal-billing-chip--compact {
  margin-top: 0;
}
.schedule-billing-line {
  margin: 8px 0 0;
  line-height: 1.45;
}
.schedule-billing-pause-hint {
  color: #b91c1c;
}
.people-buffer-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.balance-pause-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, rgba(239, 68, 68, 0.4) 80%, var(--border));
  background: color-mix(in srgb, rgba(239, 68, 68, 0.08) 100%, var(--panel));
  color: inherit;
  line-height: 1.5;
}
.balance-buffer-warn {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, rgba(245, 158, 11, 0.35) 80%, var(--border));
  background: color-mix(in srgb, rgba(245, 158, 11, 0.08) 100%, var(--panel));
}
.credit-chip--completed {
  background: color-mix(in srgb, rgba(34, 197, 94, 0.12) 100%, transparent);
  color: #16a34a;
  border: 1px solid color-mix(in srgb, rgba(34, 197, 94, 0.35) 80%, var(--border));
}
.credit-chip--disputed {
  background: color-mix(in srgb, rgba(245, 158, 11, 0.12) 100%, transparent);
  color: #b45309;
  border: 1px solid color-mix(in srgb, rgba(245, 158, 11, 0.35) 80%, var(--border));
}
html[data-theme="light"] .credit-chip--completed {
  color: #15803d;
}

/* —— Админ: баланс занятий —— */
.admin-credits-lead {
  max-width: 44rem;
  line-height: 1.5;
  margin: 0;
}
.admin-credits-mount {
  margin-top: 8px;
}
.admin-credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.admin-credit-card {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  padding: 16px 18px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.admin-credit-card:hover {
  border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 22%);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--shadow) 55%, transparent);
}
.admin-credit-card--low {
  border-color: color-mix(in srgb, rgba(234, 179, 8, 0.45) 70%, var(--border));
}
.admin-credit-card--neg {
  border-color: color-mix(in srgb, rgba(239, 68, 68, 0.4) 75%, var(--border));
  background: color-mix(in srgb, rgba(239, 68, 68, 0.06) 40%, var(--panel));
}
.admin-credit-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.admin-credit-name {
  font-weight: 650;
  font-size: 1.02rem;
}
.admin-credit-teacher {
  font-size: 13px;
  margin-top: 4px;
}
.admin-credit-balance {
  text-align: right;
  line-height: 1.2;
}
.admin-credit-balance-num {
  display: block;
  font-size: 1.65rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.admin-credit-warn {
  margin: 10px 0 0;
  font-size: 12px;
  color: #b45309;
}
.admin-credit-warn--neg {
  color: var(--danger, #dc2626);
}
.admin-credit-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 12px;
  font-size: 13px;
}
.admin-credit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.admin-credits-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.admin-credits-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-credits-tab {
  border: 1px solid var(--border);
  background: var(--white);
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.admin-credits-tab:hover { border-color: var(--border-strong); }
.admin-credits-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.admin-credits-toolbar-row,
.admin-credits-history-toolbar {
  margin: 0;
}
.admin-credits-archive-toggle {
  font-size: 13px;
  white-space: nowrap;
}
.admin-credit-card--archive {
  opacity: 0.92;
  border-style: dashed;
}
.admin-credit-archive-chip {
  margin-left: 8px;
  font-size: 11px;
  vertical-align: middle;
}
.admin-credit-children-list {
  margin: 6px 0 0;
  padding: 0;
  font-size: 13px;
}
.admin-credit-children-list li { padding: 2px 0; }
.admin-credits-teacher-group {
  margin-bottom: 22px;
}
.admin-credits-teacher-head {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 650;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin-credits-archive-section {
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
}
.admin-credits-archive-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--muted);
}
.admin-credits-history-wrap {
  margin-top: 28px;
  padding-top: 8px;
}
.admin-credits-history-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 650;
}
.admin-credits-tx-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.admin-credits-tx-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  font-size: 13px;
}
.admin-credits-tx-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.admin-credits-tx-delta.is-pos {
  color: #16a34a;
}
.admin-credits-tx-delta.is-neg {
  color: var(--danger, #dc2626);
}
.admin-credits-tx-by {
  flex-shrink: 0;
  max-width: 42%;
  text-align: right;
}

/* —— Админ: цены и выплаты —— */
.billing-pricing-lead {
  max-width: 44rem;
  line-height: 1.5;
  margin: 0;
}
.billing-pricing-mount {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}
.billing-defaults-form .billing-defaults-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 18px;
  margin-top: 10px;
}
.billing-defaults-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink2);
}
.billing-defaults-form input[type="number"] {
  width: 100%;
  max-width: 12rem;
}
.billing-table-panel .balance-child-name {
  margin-bottom: 8px;
}
.billing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.billing-toolbar-search {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--side-input-bg, rgba(255, 255, 255, 0.06));
  color: var(--ink);
  font-size: 14px;
}
.billing-toolbar-select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink);
  font-size: 14px;
}
.billing-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.billing-table th,
.billing-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.billing-table th {
  font-weight: 600;
  color: var(--ink2);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  white-space: nowrap;
}
.billing-table tbody tr:last-child td {
  border-bottom: none;
}
.billing-inline-num,
.billing-inline-text {
  width: 100%;
  min-width: 0;
  max-width: 8rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--side-input-bg, rgba(255, 255, 255, 0.06));
  color: var(--ink);
  font-size: 13px;
}
.billing-inline-text {
  max-width: 16rem;
}
.billing-teacher-balance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.billing-table td.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.admin-credit-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-credit-modal[hidden] {
  display: none !important;
}
.admin-credit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}
.admin-credit-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: var(--panel);
  box-shadow: var(--shadow-lg, 0 22px 50px rgba(0, 0, 0, 0.28));
  padding: 18px 20px 20px;
}
.admin-credit-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.admin-credit-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
}
.admin-credit-modal-student {
  margin: 0 0 14px;
  font-size: 14px;
}
.admin-credit-modal-form label {
  display: block;
  margin-bottom: 12px;
}
.admin-credit-quick-row {
  margin-bottom: 10px;
}
.admin-credit-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.admin-credit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.portal-password-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.portal-password-modal[hidden] {
  display: none !important;
}
.portal-password-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}
.portal-password-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 20px;
  color: var(--ink);
}
.portal-password-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.portal-password-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink);
}
.portal-password-modal-sub {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
}
.portal-password-modal-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--danger, #dc2626);
  background: color-mix(in srgb, var(--danger, #dc2626) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 28%, transparent);
}
.portal-password-modal-error[hidden] {
  display: none !important;
}
.portal-password-modal-form label {
  display: block;
  margin-bottom: 12px;
}
#portalPasswordCurrentWrap[hidden],
.portal-password-modal-dialog[data-password-mode="reset"] #portalPasswordCurrentWrap {
  display: none !important;
}
.password-field {
  position: relative;
  display: block;
}
.password-field input {
  width: 100%;
  padding-right: 44px;
}
.password-field-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.password-field-toggle:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--border) 40%, transparent);
}
.password-field-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.password-field-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-field-toggle[aria-pressed="true"] .password-field-icon--show {
  display: none;
}
.password-field-toggle[aria-pressed="false"] .password-field-icon--hide {
  display: none;
}
.portal-password-modal-hint {
  margin: 4px 0 0;
  line-height: 1.45;
}
.portal-password-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.portal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--panel);
  background: color-mix(in srgb, var(--ink, #0f172a) 92%, var(--accent));
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.2));
  max-width: min(420px, calc(100vw - 32px));
  text-align: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.portal-toast[hidden] {
  display: none !important;
}
.portal-toast--out {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}
html[data-theme="light"] .portal-toast {
  background: var(--ink2, #1e293b);
  color: #fff;
}

/* Поддержка и споры (админ) */
.support-mount { max-width: min(1040px, 100%); width: 100%; }
.support-admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.support-admin-layout > div:last-child {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.support-thread-list { display: grid; gap: 8px; margin-bottom: 16px; max-height: var(--portal-chat-height); overflow-y: auto; }
.support-thread-pill {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.support-thread-pill:hover { border-color: var(--border-strong); }
.support-thread-pill.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.support-chat-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-solid);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: clamp(420px, calc(100dvh - 16rem), 560px);
  max-height: var(--portal-chat-height);
}
.support-msg-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.support-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.support-msg--system {
  align-self: center;
  max-width: 96%;
  background: var(--glass);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
}
.support-msg--me { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--border-strong); }
.support-msg--them { align-self: flex-start; background: var(--white); border: 1px solid var(--border); }
.support-msg-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.support-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.support-compose textarea { flex: 1 1 280px; min-height: 72px; resize: vertical; }
.admin-disputes-mount { display: grid; gap: 12px; }
.admin-dispute-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--white);
  text-align: left;
}
.admin-dispute-card .btn { margin-top: 10px; margin-right: 8px; }
.admin-dispute-modal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px)) 12px 12px;
  overflow-y: auto;
}
.admin-dispute-modal[hidden] { display: none !important; }
.admin-dispute-modal-backdrop {
  position: fixed; inset: 0; z-index: 0;
  background: rgba(6, 10, 20, 0.5);
  backdrop-filter: blur(8px);
}
.admin-dispute-modal-dialog {
  position: relative; z-index: 1;
  width: min(640px, 100%);
  max-height: min(calc(100dvh - 24px), 90vh);
  margin: 24px auto;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.admin-dispute-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.admin-dispute-modal-body {
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
}
.admin-dispute-detail-block { margin-bottom: 14px; }
.admin-dispute-detail-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.admin-dispute-timeline { list-style: none; padding: 0; margin: 0; }
.admin-dispute-timeline li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

.lesson-issue-modal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.lesson-issue-modal[hidden] { display: none !important; }
.lesson-issue-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.55);
}
.lesson-issue-modal-dialog {
  position: relative; width: min(520px, 100%); max-height: min(90dvh, 720px);
  display: flex; flex-direction: column; background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.lesson-issue-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.lesson-issue-modal-body {
  padding: 16px; overflow: auto; flex: 1; min-height: 0;
}
.lesson-issue-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px;
}
.lesson-issue-modal-meta { margin-bottom: 12px; }
.lesson-issue-status-slot { margin-left: 8px; }
.lesson-issue-chip {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.lesson-issue-chip--pending { background: rgba(251,191,36,.2); color: #fbbf24; }
.lesson-issue-chip--in_progress { background: rgba(96,165,250,.2); color: #60a5fa; }
.lesson-issue-chip--resolved { background: rgba(74,222,128,.2); color: #4ade80; }
.lesson-issue-chip--closed { background: rgba(148,163,184,.25); color: #94a3b8; }
.admin-lesson-issues-filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px;
}
.admin-lesson-issues-mount .support-admin-layout { min-height: 420px; }
.admin-lesson-issue-status-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px;
}
.admin-lesson-issue-credit {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--glass) 80%, transparent);
}
.admin-lesson-issue-credit-title {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.admin-lesson-issue-credit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

html[data-theme="light"] .support-msg--them { background: #f8fafc; }

/* --- Методическая платформа --- */
.methodology-view { padding: 0 !important; }
.methodology-shell {
  --meth-lesson-read-max: min(56rem, 100%);
  display: grid;
  grid-template-columns: minmax(248px, 300px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 0;
  min-height: calc(100dvh - 12rem);
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface-solid);
}
.methodology-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--glass);
}
.methodology-sidebar-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
}
html[data-theme="light"] .methodology-sidebar-sticky {
  background: var(--surface-solid);
}
.methodology-sidebar-lead { margin: 0 0 12px; font-size: 12px; line-height: 1.45; opacity: 0.85; }
.meth-sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.meth-sidebar-title-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.meth-head-add-course {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-mid);
  color: var(--muted);
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.meth-head-add-course:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-soft);
}
.meth-sticky-inline-create {
  margin-top: 12px;
  padding-top: 0;
}
.meth-sticky-inline-create[hidden] {
  display: none !important;
}
.meth-inline-create-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meth-inline-create-row--embedded {
  margin: 0 0 10px;
  padding: 8px 10px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-mid) 88%, transparent);
}
.meth-inline-create-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.75;
}
.meth-inline-submit-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.meth-inline-create-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink);
}
.meth-inline-create-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.methodology-sidebar-head { padding: 14px 14px 14px; flex-shrink: 0; }
.methodology-sidebar-title {
  font-size: 16px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.methodology-search-row { display: flex; gap: 6px; flex-wrap: wrap; }
.methodology-search-input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--ink);
}
.methodology-search-results {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
}
.methodology-search-results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.methodology-search-results button:last-child { border-bottom: 0; }
.methodology-search-results button:hover { background: var(--accent-soft); }
.methodology-tree-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 20px;
  scrollbar-gutter: stable;
}
.methodology-tree details.meth-tree-course {
  margin-bottom: 4px;
  border-radius: 10px;
  position: relative;
  z-index: 0;
}
.methodology-tree details.meth-tree-mod {
  margin-bottom: 2px;
  border-radius: 8px;
  position: relative;
  z-index: 0;
}
/* Выпадающее меню «⋯» визуально ниже строки, но в DOM внутри неё — без z-index следующая строка перекрывает панель */
.methodology-tree details.meth-tree-course:has(.meth-tree-more-panel:not([hidden])),
.methodology-tree details.meth-tree-mod:has(.meth-tree-more-panel:not([hidden])) {
  z-index: 14;
}
/* Меню на строке курса/модуля: иначе .meth-*-body (идёт после summary в DOM) рисуется поверх панели */
.methodology-tree details.meth-tree-course:has(> .meth-course-summary .meth-tree-more-panel:not([hidden])) > .meth-course-summary {
  z-index: 16;
}
.methodology-tree details.meth-tree-course:has(> .meth-course-summary .meth-tree-more-panel:not([hidden])) > .meth-course-body {
  position: relative;
  z-index: 0;
}
.methodology-tree details.meth-tree-mod:has(> .meth-mod-summary .meth-tree-more-panel:not([hidden])) > .meth-mod-summary {
  z-index: 16;
}
.methodology-tree details.meth-tree-mod:has(> .meth-mod-summary .meth-tree-more-panel:not([hidden])) > .meth-mod-body {
  position: relative;
  z-index: 0;
}
.methodology-tree summary {
  cursor: pointer;
  list-style: none;
  border-radius: inherit;
}
/* --- Row shell: gutter | stack (title + meta) | endcap (absolute) --- */
.meth-tree-summary {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  padding-right: 10px;
  transition: background 0.15s ease;
}
.meth-tree-summary--course {
  padding-top: 10px;
  padding-bottom: 10px;
}
.meth-tree-summary--module {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 6px;
}
.meth-tree-summary--course:has(.meth-tree-endcap),
.meth-tree-summary--module:has(.meth-tree-endcap) {
  padding-right: 4.75rem;
}
.meth-tree-gutter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.meth-tree-gutter--course {
  pointer-events: none;
}
.meth-tree-gutter--course .meth-tree-chevron {
  pointer-events: none;
}
.meth-mod-expand:hover {
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
  color: var(--ink);
}
.meth-tree-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding-top: 1px;
}
.meth-tree-stack--course {
  gap: 6px;
}
.meth-course-title {
  margin: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.015em;
  color: var(--accent);
  overflow-wrap: anywhere;
  word-break: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.meth-course-desc {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  opacity: 0.82;
}
.meth-mod-select.meth-mod-title {
  flex: 0 1 auto;
  width: 100%;
  min-width: 0;
  text-align: left;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.32;
  padding: 4px 6px;
  margin: 0;
  margin-left: -4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  overflow-wrap: anywhere;
  word-break: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  transition: background 0.12s ease;
}
.meth-mod-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: -2px;
  padding-left: 2px;
}
.meth-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg-mid) 92%, var(--border));
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.meth-mod-meta-label {
  font-size: 11px;
  font-weight: 450;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.meth-mod-select:hover {
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.meth-mod-select.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.meth-tree-label {
  text-align: left;
}
.meth-tree-chevron::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform 0.2s var(--ease), opacity 0.15s ease;
}
details[open] > .meth-tree-summary .meth-tree-chevron::before {
  transform: rotate(45deg);
  margin-top: 2px;
  opacity: 0.75;
}
.meth-tree-endcap {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.meth-tree-summary--course .meth-tree-endcap {
  top: 14px;
  transform: none;
  align-items: flex-start;
}
.meth-tree-icon-plus {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 350;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.meth-tree-summary:hover .meth-tree-icon-plus,
.meth-tree-summary:focus-within .meth-tree-icon-plus {
  opacity: 1;
  pointer-events: auto;
}
.meth-tree-icon-plus:hover {
  border-color: var(--border);
  background: var(--accent-soft);
  color: var(--accent);
}
@media (max-width: 900px) {
  .meth-tree-icon-plus {
    opacity: 1;
    pointer-events: auto;
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
  }
}
.meth-tree-admin-zone {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.meth-tree-actions--desktop {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.meth-tree-summary:hover .meth-tree-actions--desktop,
.meth-tree-summary:focus-within .meth-tree-actions--desktop,
.meth-tree-lesson-row:hover .meth-tree-actions--desktop,
.meth-tree-lesson-row:focus-within .meth-tree-actions--desktop {
  opacity: 1;
  pointer-events: auto;
}
.meth-tree-actions--lesson {
  gap: 1px;
}
.meth-tree-more-wrap {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
}
.meth-tree-more-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent !important;
  font-size: 17px !important;
  font-weight: 600;
  line-height: 1 !important;
  letter-spacing: 0;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.18s ease;
  opacity: 0;
  pointer-events: none;
}
.meth-tree-summary:hover .meth-tree-more-toggle,
.meth-tree-summary:focus-within .meth-tree-more-toggle,
.meth-tree-lesson-row:hover .meth-tree-more-toggle,
.meth-tree-lesson-row:focus-within .meth-tree-more-toggle {
  opacity: 1;
  pointer-events: auto;
}
.meth-tree-more-toggle:hover,
.meth-tree-more-toggle[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg-mid) 75%, transparent) !important;
  color: var(--ink);
}
.meth-tree-mobile-actions {
  display: none;
  position: relative;
  align-items: center;
}
.meth-tree-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 50;
  min-width: 11.5rem;
  max-width: min(16rem, 85vw);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: flex-end;
}
/* Иначе display:flex перебивает [hidden] и меню остаётся на экране */
.meth-tree-more-panel[hidden] {
  display: none !important;
  pointer-events: none;
}
.meth-tree-iconbtn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 7px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1;
}
.meth-tree-iconbtn--compact {
  padding: 6px 6px;
  font-size: 11px;
  min-width: 1.5rem;
}
.meth-tree-iconbtn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.meth-tree-iconbtn:hover {
  background: var(--accent-soft);
}
.meth-tree-iconbtn--danger:hover {
  background: rgba(251, 113, 133, 0.18);
}
.meth-tree-lesson-row {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: stretch;
  margin-bottom: 2px;
  border-radius: 8px;
  transition: background 0.12s ease;
}
.meth-tree-lesson-row:has(.meth-tree-more-panel:not([hidden])) {
  z-index: 15;
}
.meth-tree-lesson-row:has(.meth-tree-admin-zone) {
  padding-right: 4.5rem;
}
.meth-tree-lesson-row:hover {
  background: color-mix(in srgb, var(--accent-soft) 28%, transparent);
}
.meth-tree-lesson-row .methodology-lesson-btn {
  flex: 1 1 auto;
  min-width: 0;
}
.meth-tree-lesson-row .meth-tree-admin-zone {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.meth-lesson-bullet {
  flex: 0 0 auto;
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  margin-top: 0.45em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 65%, var(--border));
  vertical-align: top;
}
.meth-inline-input {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg-mid);
  color: var(--ink);
}
.meth-inline-loading {
  opacity: 0.55;
  pointer-events: none;
}
.methodology-tree summary::-webkit-details-marker { display: none; }
.meth-course-summary:hover,
.meth-mod-summary:hover {
  background: color-mix(in srgb, var(--accent-soft) 22%, transparent);
}
.methodology-mod-title { font-size: 13px; font-weight: 600; color: var(--ink2); padding: 4px 8px 2px 12px; }
.meth-course-body {
  padding: 2px 8px 10px 34px;
}
.meth-mod-body {
  padding: 2px 8px 8px 28px;
}
.methodology-lesson-btn {
  display: flex;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 7px 10px 7px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
  font-size: 12.5px;
  font-weight: 420;
  line-height: 1.34;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.meth-lesson-title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.methodology-lesson-btn:hover {
  background: transparent;
  color: var(--ink);
}
.methodology-lesson-btn.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.methodology-lesson-btn.archived { opacity: 0.55; }
.methodology-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
  overflow: hidden;
}
.methodology-main-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface-solid) 70%, transparent);
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.methodology-main-topbar .methodology-panel-toggle {
  display: inline-flex !important;
  flex-shrink: 0;
}
.methodology-panel-toggle.is-off {
  opacity: 0.72;
  border-style: dashed;
}
.methodology-panel-collapse-btn {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-mid);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.methodology-panel-collapse-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
  background: var(--accent-soft);
}
.methodology-panel-collapse-btn[hidden] { display: none !important; }
.methodology-right-head {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.methodology-right-head .methodology-tabs {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}
.methodology-right-head .methodology-panel-collapse-btn {
  align-self: center;
  margin: 6px 8px 6px 0;
}
@media (min-width: 901px) {
  .methodology-panel-collapse-btn { display: inline-flex; }
  .methodology-shell.meth-shell--sidebar-hidden > .methodology-sidebar { display: none; }
  .methodology-shell.meth-shell--sidebar-hidden:not(.meth-shell--right-hidden) {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  }
  .methodology-shell.meth-shell--right-hidden:not(.meth-shell--sidebar-hidden) {
    grid-template-columns: minmax(248px, 300px) minmax(0, 1fr);
  }
  .methodology-shell.meth-shell--sidebar-hidden.meth-shell--right-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
}
.methodology-shell.meth-shell--right-hidden > .methodology-right { display: none; }
.methodology-breadcrumb { font-size: 12px; margin-bottom: 0; line-height: 1.4; flex: 1; min-width: 0; }
.methodology-article-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.methodology-empty { padding: 24px 8px; text-align: center; }
/* Шапка и редактор визуально в одной колонке с телом урока */
.methodology-lesson-header,
.methodology-editor {
  max-width: var(--meth-lesson-read-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}
.methodology-lesson-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.methodology-lesson-header-text {
  flex: 1 1 220px;
  min-width: 0;
  align-self: flex-start;
}
.methodology-lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.methodology-lesson-title { font-family: "Unbounded", system-ui, sans-serif; font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
.methodology-lesson-summary { margin-top: 6px; font-size: 14px; line-height: 1.45; }
.methodology-lesson-meta { margin-top: 8px; font-size: 12px; line-height: 1.4; }
.methodology-archived-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warm-deep);
  color: var(--coral);
  border: 1px solid rgba(251, 113, 133, 0.35);
}
.methodology-archived-badge[hidden] {
  display: none !important;
}
.mdoc-prose {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 42rem;
}
.methodology-reading.mdoc-prose,
.methodology-article-wrap .mdoc-prose {
  max-width: var(--meth-lesson-read-max);
  margin-left: auto;
  margin-right: auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink2);
}
.mdoc-prose--compact {
  font-size: 13px;
  line-height: 1.5;
  max-width: none;
}
.mdoc-prose--compact p:first-child { margin-top: 0; }
.mdoc-prose h1 { font-size: 1.65rem; margin: 1.2em 0 0.5em; font-weight: 700; }
.mdoc-prose h2 { font-size: 1.35rem; margin: 1.1em 0 0.45em; font-weight: 650; }
.mdoc-prose h3 { font-size: 1.15rem; margin: 1em 0 0.4em; font-weight: 600; }
.mdoc-prose p { margin: 0.65em 0; }
.mdoc-prose ul, .mdoc-prose ol { margin: 0.6em 0; padding-left: 1.35em; }
.mdoc-prose blockquote {
  margin: 0.8em 0;
  padding: 8px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--glass);
  border-radius: 0 10px 10px 0;
  color: var(--ink2);
}
.mdoc-prose pre {
  margin: 0.85em 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
html[data-theme="light"] .mdoc-prose pre {
  background: #f1f5f9;
}
.mdoc-prose code { font-size: 0.9em; }
.mdoc-prose pre code { background: none; border: 0; padding: 0; }
.mdoc-prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14px; }
.mdoc-prose th, .mdoc-prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.mdoc-prose th { background: var(--glass); font-weight: 600; }
.mdoc-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.meth-obs-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.methodology-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.methodology-md-input {
  width: 100%;
  min-height: 280px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--ink);
  resize: vertical;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.5;
}
.methodology-preview { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px dashed var(--border); }
.methodology-editor-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.methodology-editor-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.methodology-edit-toggle { margin-top: 12px; }
.methodology-right {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(15, 23, 42, 0.35);
}
html[data-theme="light"] .methodology-right { background: #f8fafc; }
.methodology-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  flex-shrink: 0;
  align-items: stretch;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.methodology-tab {
  margin: 0;
  min-height: 42px;
  padding: 8px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.methodology-tab:hover { color: var(--ink); }
.methodology-tab.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
}
.methodology-context-banner {
  margin: 0;
  padding: 8px 12px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  background: rgba(129, 140, 248, 0.05);
}
html[data-theme="light"] .methodology-context-banner {
  background: #f1f5f9;
}
.methodology-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.methodology-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 12px 0 8px; }
.methodology-subhead--after-form {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.methodology-compose-first {
  margin-bottom: 0;
}
.methodology-notes-input {
  min-height: 88px;
  resize: vertical;
}
.methodology-compose-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.methodology-module-only-msg {
  max-width: 28rem;
  margin: 0 auto;
  text-align: center;
  line-height: 1.5;
}
.methodology-thread { display: flex; flex-direction: column; gap: 10px; }
.methodology-msg {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--white);
  text-align: left;
}
html[data-theme="light"] .methodology-msg { background: #fff; }
.methodology-msg.pinned { border-color: var(--border-strong); box-shadow: 0 0 0 1px var(--accent-soft); }
.methodology-msg--note {
  background: rgba(129, 140, 248, 0.04);
}
html[data-theme="light"] .methodology-msg--note {
  background: #f8fafc;
}
.methodology-insights {
  flex-shrink: 0;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--border);
  background: rgba(129, 140, 248, 0.06);
}
html[data-theme="light"] .methodology-insights {
  background: #eef2ff;
}
.methodology-insights-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.methodology-insights-list {
  margin: 0;
  padding: 0 0 0 1rem;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink2);
}
.methodology-insights-list li { margin-bottom: 6px; }
.methodology-insights-line { display: block; }
.methodology-panel-hint { margin: 0 0 10px; }
.methodology-compose-quick textarea:not(.methodology-notes-input) {
  min-height: 56px;
}
.methodology-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
}
.methodology-modal[hidden] {
  display: none !important;
}
.methodology-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.methodology-modal-card {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.methodology-modal-card--danger {
  border-color: rgba(251, 113, 133, 0.45);
}
.methodology-modal-title {
  margin: 0 0 10px;
  font-size: 1.1rem;
}
.methodology-modal-body {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}
.methodology-modal-impact {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.25);
  color: var(--ink);
}
.methodology-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.methodology-modal-danger-btn {
  background: rgba(251, 113, 133, 0.2) !important;
  border: 1px solid rgba(251, 113, 133, 0.45) !important;
  color: var(--coral) !important;
}
.methodology-read-modal .methodology-read-card {
  max-width: min(56rem, 96vw);
  max-height: 90dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.methodology-read-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.methodology-read-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
#methodologyReadModalProse {
  padding: 16px 18px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.methodology-msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.methodology-badge { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.methodology-badge.admin { background: rgba(251, 113, 133, 0.15); color: var(--coral); }
.methodology-msg-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.methodology-compose textarea {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--ink);
  resize: vertical;
  min-height: 72px;
}
.methodology-tag-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.methodology-tag-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink2);
  cursor: pointer;
}
.methodology-tag-chip.on { background: var(--accent-soft); border-color: var(--border-strong); color: var(--accent); }
.methodology-obs-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.methodology-obs-pick label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
/* Скрытые чекбоксы для формы; теги только в .methodology-tag-quick */
.methodology-obs-pick--sr {
  display: none;
}
.methodology-admin-panel {
  border-top: 1px solid var(--border);
  padding: 10px;
  background: var(--bg-deep);
}
.methodology-admin-details summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 6px 0; }
.methodology-mini-form label { font-size: 12px; }
.methodology-mini-form input, .methodology-mini-form select { font-size: 13px; padding: 6px 8px; }
.methodology-subpanel { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.methodology-mobile-close { float: right; }

.nav-meth-badge {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  vertical-align: middle;
}
/* Иначе display:inline-block перебивает UA-стиль [hidden] и видно «0» */
.nav-meth-badge[hidden] {
  display: none !important;
}
.nav-methodology { position: relative; }

.meth-action-admin-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.meth-admin-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.meth-admin-more summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin: 0;
}
.meth-admin-more summary::-webkit-details-marker { display: none; }
.meth-admin-more-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 200px;
  padding: 6px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 40;
}
.meth-more-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink2);
  font: inherit;
  cursor: pointer;
}
.meth-more-item:hover { background: var(--accent-soft); color: var(--ink); }
.meth-more-danger { color: var(--danger); }

.methodology-editor-sticky {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: 0 0 12px;
  padding: 10px 0;
  background: linear-gradient(180deg, var(--bg-deep) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
.methodology-editor-sticky-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.meth-unsaved-badge {
  font-size: 12px;
  color: var(--warn);
}
.meth-draft-ind { font-size: 11px; }
.methodology-editor-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.methodology-editor-body.is-split {
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
}
.methodology-editor-body.is-split .methodology-md-input {
  flex: 1;
  min-width: 0;
}
.methodology-editor-body.is-split .methodology-preview-pane {
  flex: 1;
  min-width: 0;
  max-height: min(70vh, 520px);
  overflow: auto;
  margin-top: 0 !important;
}
.meth-md-hint {
  margin: 0 0 10px;
  line-height: 1.45;
}
.meth-md-hint code {
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--glass);
}

.methodology-change-card {
  max-width: 520px;
  width: calc(100% - 32px);
}
.meth-change-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.meth-change-lead { margin: 8px 0 14px; line-height: 1.45; }
.meth-change-form label { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 12px; }
.meth-change-field select,
.meth-change-field textarea {
  width: 100%;
  margin-top: 6px;
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--ink);
}
.meth-change-details {
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  padding: 8px 10px;
}
.meth-change-details summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.meth-change-actions { margin-top: 16px; }

.meth-mobile-fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0));
  z-index: 900;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--accent);
  color: #0b1020;
  font-size: 22px;
  line-height: 1;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
@media (min-width: 901px) {
  .meth-mobile-fab { display: none; }
}

.meth-prop-kind {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 4px 0 6px;
}
.meth-status-pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.meth-prop-admin-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.meth-prop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.meth-sug-note-input {
  width: 100%;
  font: inherit;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-mid);
  color: var(--ink);
  resize: vertical;
}
.meth-admin-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.4;
}
.methodology-msg--proposal {
  border-left: 3px solid rgba(129, 140, 248, 0.45);
}
.methodology-panel-activity .meth-activity-item {
  border-radius: 10px;
}
.meth-activity-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.meth-activity-snippet { margin-top: 4px; line-height: 1.35; }

@media (max-width: 1100px) {
  .methodology-shell { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
  .methodology-right { grid-column: 1 / -1; max-height: 380px; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 1100px) and (min-width: 901px) {
  .methodology-shell.meth-shell--sidebar-hidden:not(.meth-shell--right-hidden) {
    grid-template-columns: minmax(0, 1fr);
  }
  .methodology-shell.meth-shell--right-hidden:not(.meth-shell--sidebar-hidden) {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}
@media (max-width: 900px) {
  .methodology-shell {
    display: flex;
    flex-direction: column;
    min-height: auto;
    border-radius: var(--radius-xl);
  }
  .methodology-main {
    order: 1;
    padding-top: 8px;
  }
  .methodology-right {
    order: 2;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .methodology-sidebar {
    order: 3;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 92vw);
    transform: translateX(-102%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-lg);
    background: var(--surface-solid);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .methodology-sidebar.open { transform: translateX(0); }
  .methodology-sidebar .methodology-tree-scroll {
    background: var(--surface-solid);
  }
  .methodology-mobile-close:not([hidden]) { display: inline-flex !important; }
  .methodology-sidebar-sticky {
    position: relative;
    top: auto;
    box-shadow: none;
  }
  .meth-tree-actions--desktop {
    display: none !important;
  }
  .meth-tree-mobile-actions {
    display: flex !important;
    width: auto;
    min-width: 0;
  }
  .meth-tree-mobile-actions .meth-tree-more-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
    min-width: 38px;
    min-height: 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
  .meth-tree-admin-zone {
    width: auto;
    min-width: 0;
  }
  .meth-tree-summary--course:has(.meth-tree-endcap),
  .meth-tree-summary--module:has(.meth-tree-endcap) {
    padding-right: 6.75rem;
  }
  .meth-tree-summary--course .meth-tree-endcap {
    top: 50%;
    transform: translateY(-50%);
    align-items: center;
  }
  .meth-tree-lesson-row .meth-tree-admin-zone {
    top: 50%;
    transform: translateY(-50%);
  }
}

.admin-cal-audit-filters {
  margin-bottom: 1rem;
}
.admin-cal-audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.admin-cal-audit-row-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-cal-audit-pre {
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
}
.schedule-occ-stale-warn {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--warn-bg, #fff8e6);
  border: 1px solid var(--warn-border, #e8c96a);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------------------
   Family account: profile chooser, PIN modals, switcher, child-mode chrome.
   (D-AUTH redesign — front-end. API enforces the security boundary; these
   styles support the chooser/PIN UX and hide finance affordances in child mode.)
--------------------------------------------------------------------------- */
.family-locked { overflow: hidden; }
.family-overlay[hidden] {
  display: none !important;
}
.family-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.family-card {
  width: 100%;
  max-width: 540px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
.family-card--pin { max-width: 420px; }
.family-title { margin: 0 0 0.35rem; font-size: 1.4rem; color: var(--ink); }
.family-sub { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.95rem; }
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.9rem;
}
.family-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1.1rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.family-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.family-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.family-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6c8cff, #a06cff);
}
.family-tile--child .family-avatar { background: linear-gradient(135deg, #2fbf8f, #2f9fbf); }
.family-name { font-weight: 600; color: var(--ink); }
.family-role { font-size: 0.78rem; color: var(--muted); }
.family-err { min-height: 1.2rem; margin: 0.75rem 0 0; color: var(--danger); font-size: 0.88rem; }
.family-foot { margin-top: 1.25rem; text-align: center; }
.family-link, .family-btn-ghost {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  font: inherit;
}
.family-pin-form { display: flex; flex-direction: column; gap: 0.85rem; }
.family-label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; color: var(--muted); }
.family-input {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
}
.family-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}
.family-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.4rem; }
.family-btn {
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}
.family-btn:hover { background: var(--accent-hover); }
.family-btn-ghost { text-decoration: none; padding: 0.65rem 1rem; border-radius: 10px; border: 1px solid var(--border); }
.family-toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(12px);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1100;
  box-shadow: var(--shadow-md);
}
.family-toast--in { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Child mode: hide finance/settings/child-management affordances (defense-in-depth). */
.family-child-mode [data-view='balance'],
.family-child-mode [data-view='payments'],
.family-child-mode [data-view='admin-credits'],
.family-child-mode [data-view='billing-pricing'],
.family-child-mode [data-view='people'],
.family-child-mode [data-view='approvals'],
.family-child-mode [data-balance-pay],
.family-child-mode [data-family-finance] {
  display: none !important;
}

/* —— Большие экраны —— */
@media (min-width: 1280px) {
  :root {
    --portal-list-max: clamp(420px, calc(100dvh - var(--portal-chrome)), 840px);
    --portal-chat-height: clamp(360px, calc(100dvh - 14rem), min(820px, 85dvh));
  }
  .app {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  }
  .main {
    padding: 32px 36px;
    padding-left: max(36px, env(safe-area-inset-left, 0px));
    padding-right: max(36px, env(safe-area-inset-right, 0px));
  }
  .chat-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
  .support-admin-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
  .grid { gap: 20px; }
  .metric-grid { gap: 16px; }
}

@media (min-width: 1440px) {
  :root {
    --portal-list-max: clamp(480px, calc(100dvh - var(--portal-chrome)), 920px);
    --portal-chat-height: clamp(400px, calc(100dvh - 14rem), min(880px, 86dvh));
  }
  .app {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  }
  .methodology-shell {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(280px, 360px);
  }
  .methodology-shell.meth-shell--sidebar-hidden:not(.meth-shell--right-hidden) {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  }
  .methodology-shell.meth-shell--right-hidden:not(.meth-shell--sidebar-hidden) {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }
  .support-mount { max-width: min(1200px, 100%); }
  .homework-hub-panel { max-width: 1040px; }
  .lead { max-width: 880px; }
  .panel { padding: 20px; }
  .metric strong { font-size: 32px; }
}

@media (min-width: 1680px) {
  :root {
    --portal-shell-max: 1920px;
  }
  .app {
    max-width: var(--portal-shell-max);
    margin: 0 auto;
    box-shadow: 0 0 0 1px var(--border);
  }
  .main {
    padding: 36px 48px;
    padding-left: max(48px, env(safe-area-inset-left, 0px));
    padding-right: max(48px, env(safe-area-inset-right, 0px));
  }
  .login-shell { width: min(980px, 100%); }
  .grid.four { gap: 20px; }
  .cal-week-board {
    grid-template-columns: 80px repeat(7, minmax(0, 1fr));
  }
}

@media (min-width: 1920px) {
  :root {
    --portal-list-max: clamp(520px, calc(100dvh - var(--portal-chrome)), 960px);
    --portal-shell-max: 2100px;
  }
  body { font-size: 16px; }
  .side { padding: 28px 22px; }
  .chat-layout {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }
  .bubble { max-width: min(78%, 28rem); }
  h1 { font-size: clamp(1.5rem, 1.1vw + 1rem, 2.1rem); }
  .support-mount { max-width: min(1280px, 100%); }
}

@media (min-width: 2560px) {
  :root {
    --portal-shell-max: 2280px;
    --portal-list-max: clamp(560px, calc(100dvh - var(--portal-chrome)), 1000px);
    --portal-chat-height: clamp(440px, calc(100dvh - 14rem), min(920px, 88dvh));
  }
  .main { padding: 40px 56px; }
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

.site-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.site-analytics-funnel-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.site-analytics-funnel-bar {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-2, rgba(255,255,255,0.06));
  overflow: hidden;
}
.site-analytics-funnel-bar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: linear-gradient(90deg, rgba(99,102,241,0.55), rgba(129,140,248,0.85));
}
.site-analytics-funnel-bar span {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
  font-weight: 600;
}
.site-analytics-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-analytics-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.site-analytics-leads { margin-top: 8px; }
