
:root {
  /* Палитра — точный зелёный с эмблемы Nihol Academy (#01AE5E) */
  --green: #01AE5E;
  --green-dark: #018C4C;
  --green-deep: #023E43;
  --green-light: #E4F8ED;
  --green-wash: #F4FBF7;
  --yellow: #B8860B;
  /* --yellow задуман для надписи на жёлтой подложке; на белом фоне он даёт
     контраст 3.25 — для строки текста мало, поэтому есть отдельный тёмный тон */
  --yellow-deep: #7A5A08;
  --yellow-light: #FBF1DC;
  --red: #B23A2E;
  --red-light: #FBEAE7;
  --text-main: #14231C;
  --text-secondary: #5C6D64;
  --border: #E0EAE4;
  --bg: #F6FBF8;
  --surface: #FFFFFF;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 61, 38, 0.05), 0 1px 1px rgba(11, 61, 38, 0.03);
  --shadow-md: 0 10px 28px -10px rgba(11, 61, 38, 0.16);
  --shadow-lg: 0 24px 56px -16px rgba(11, 61, 38, 0.22);
  --font-display: 'Fraunces', Georgia, serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Тёмная тема ---- */
body.dark-theme {
  --green: #1FD478;
  --green-dark: #17B366;
  --green-deep: #7BE8B0;
  --green-light: #16261D;
  --green-wash: #131F19;
  --yellow: #E0B33C;
  --yellow-deep: #E0B33C;
  --yellow-light: #2E2712;
  --red: #E36B5C;
  --red-light: #2E1815;
  --text-main: #EAF3EC;
  --text-secondary: #93A79C;
  --border: #263630;
  --bg: #0E1712;
  --surface: #182620;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 56px -16px rgba(0, 0, 0, 0.6);
}

/* Переключатель темы — добавляется через js/premium-interactions.js на все страницы */
.theme-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s var(--ease);
}
.theme-toggle-btn:hover { transform: scale(1.08); }

* { box-sizing: border-box; }

/* Видимый фокус только с клавиатуры: мышь рамку не рисует, Tab — рисует. */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Плавное появление при прокрутке (js/premium-interactions.js) ---- */
.has-scroll-reveal .metric-card,
.has-scroll-reveal .nav-tile {
  animation: none;
}

.has-scroll-reveal .reveal-item {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.has-scroll-reveal .reveal-item.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Вход — светлое «жидкое стекло» (решение владельца 2026-10-27, макет
   tools/mockups/login-light.html). Общий вид для index.html и страниц
   с карточкой .login-card (вход по коду, тест, кухня, 404): плывущий
   цветной фон, стеклянная карточка, кнопка с бликом. Двухколоночный вид
   с эмблемой слева — только у index.html (.login-main); в приложении —
   свой блок ниже («Вход в приложении»).
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #F3FBF6;
}
/* Плывущий перелив: мягкие цветные пятна, медленно поворачиваются */
.login-wrap::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: -2;
  background:
    radial-gradient(40% 35% at 20% 20%, #A8F0C6 0, rgba(168,240,198,0) 70%),
    radial-gradient(35% 35% at 80% 15%, #BFE3FF 0, rgba(191,227,255,0) 70%),
    radial-gradient(40% 40% at 75% 80%, #FFD9A8 0, rgba(255,217,168,0) 70%),
    radial-gradient(35% 35% at 20% 85%, #E3CCFF 0, rgba(227,204,255,0) 70%);
  animation: loginMesh 16s ease-in-out infinite alternate;
  will-change: transform;
}
/* Парящий стеклянный шар */
.login-wrap::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 220px; height: 220px;
  right: -50px; bottom: 6%;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(255,255,255,.9), rgba(255,255,255,.25));
  box-shadow: 0 20px 60px rgba(20,60,40,.12), inset 0 2px 0 #fff;
  animation: loginFloat 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes loginMesh { to { transform: rotate(8deg) scale(1.15); } }
@keyframes loginFloat { 50% { transform: translateY(-18px); } }
@keyframes loginUp { from { opacity: 0; transform: translateY(26px) scale(.97); } }
@keyframes loginBreathe { 50% { transform: scale(1.04); box-shadow: 0 20px 50px rgba(1,174,94,.55), inset 0 2px 0 rgba(255,255,255,.6); } }
@keyframes loginSweep { 60%, 100% { left: 130%; } }

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.62);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border-radius: 32px;
  border: 1px solid rgba(255,255,255,.95);
  padding: 58px 32px 28px;
  box-shadow: 0 30px 80px rgba(20,60,40,.16), inset 0 1px 0 #fff;
  color: #0E1F18;
  position: relative;
  animation: loginUp .7s .1s var(--ease) both;
  z-index: 1;
}

.lang-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.7);
  border: 1px solid #fff;
  border-radius: 12px;
  padding: 3px;
  z-index: 2;
}

.lang-toggle-btn {
  border: none;
  background: transparent;
  color: #6A8577;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.lang-toggle-btn.active {
  background: linear-gradient(135deg, #01AE5E, #00C8FF);
  color: #fff;
  box-shadow: 0 4px 12px rgba(1,174,94,.3);
}

.login-branch-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
}
.login-branch-toggle-btn {
  border: 1px solid #fff;
  background: rgba(255,255,255,.7);
  color: #018C4C;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.login-branch-toggle-btn:hover { background: #fff; }
.login-branch-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: rgba(255,255,255,.96);
  border: 1px solid #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(20,60,40,.18);
  overflow: hidden;
}
.login-branch-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #0E1F18;
  text-decoration: none;
  border-bottom: 1px solid #E6F0EA;
}
.login-branch-menu a:last-child { border-bottom: none; }
.login-branch-menu a:hover { background: #E4F8ED; }

.login-logo {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  background: linear-gradient(140deg, #01AE5E, #00C8FF);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 16px 36px rgba(1,174,94,.4), inset 0 2px 0 rgba(255,255,255,.6);
  animation: loginBreathe 3s ease-in-out infinite;
}
.login-logo img { width: 64px; height: 64px; border-radius: 19px; object-fit: cover; }

.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: #0E1F18;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: #6A8577;
  margin: 0 0 22px;
}

/* Поля и кнопка — только внутри карточки входа; на остальных страницах
   сайта .field-input и .btn-primary прежние */
.login-card .field-label { font-size: 12px; font-weight: 800; color: #4E6A5C; letter-spacing: .4px; text-transform: uppercase; margin: 0 0 6px 6px; }
.login-card .field-input { padding: 14px 16px; border-radius: 16px; border: 1.5px solid #E1EDE6; background: #fff; color: #0E1F18; font-size: 15px; }
.login-card .field-input:focus { border-color: #01AE5E; background: #fff; box-shadow: 0 0 0 4px rgba(1,174,94,.15); }
.login-card .btn-primary { padding: 16px; border-radius: 16px; font-size: 16px; font-weight: 800; background: linear-gradient(90deg, #01AE5E, #00C8FF); box-shadow: 0 14px 30px rgba(1,174,94,.35); }
.login-card .btn-primary:hover { box-shadow: 0 18px 36px rgba(1,174,94,.42); }
/* Блик, пробегающий по кнопке */
.login-card .btn-primary::before {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0));
  transform: skewX(-20deg);
  animation: loginSweep 2.8s ease-in-out infinite;
  pointer-events: none;
}
.login-card .btn-primary:disabled::before { display: none; }
.login-card .pw-eye { height: 50px; right: 8px; }

/* «Регистрация» под формой входа и сама страница записи ребёнка в школу
   (register.html, js/register.js; решение владельца 2026-10-30) */
.login-register {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 16px 0 0; padding: 12px 14px;
  border: 1.5px solid #CFEBDB; border-radius: 16px; background: rgba(255,255,255,.7);
  color: #018C4C; text-decoration: none; text-align: center;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.login-register b { font-size: 15px; font-weight: 800; }
.login-register span { font-size: 12px; color: #6A8577; }
.login-register:hover { background: #fff; border-color: #01AE5E; }
/* Перелив фона (::before, inset -25%) выходит за край, и при overflow: hidden
   браузер прокручивал его к полю ввода — после отправки карточка уезжала
   вверх. clip обрезает так же, но не прокручивается (старый Safari — hidden) */
.reg-wrap { overflow: hidden; overflow: clip; }
.reg-card { max-width: 460px; }
.reg-back {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  border: 1px solid #fff; background: rgba(255,255,255,.7); color: #018C4C;
  font-size: 12px; font-weight: 700; padding: 8px 12px; border-radius: 12px; text-decoration: none;
}
.reg-back:hover { background: #fff; }
.reg-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 16px; }
.reg-chips { display: flex; gap: 8px; margin: 0 0 16px; }
.reg-grade, .reg-chip {
  border: 1.5px solid #E1EDE6; background: #fff; color: #0E1F18; border-radius: 14px;
  font: inherit; font-weight: 800; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.reg-grade { height: 44px; font-size: 16px; }
.reg-chip { flex: 1; height: 44px; font-size: 14px; }
.reg-grade:hover, .reg-chip:hover { border-color: #01AE5E; }
.reg-grade.on, .reg-chip.on { background: linear-gradient(135deg, #01AE5E, #00C8FF); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(1,174,94,.3); }
.reg-notes { resize: vertical; min-height: 64px; }
.reg-done { text-align: center; }
.reg-done-mark {
  width: 64px; height: 64px; margin: 6px auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #01AE5E, #00C8FF); color: #fff; font-size: 32px; font-weight: 900;
  box-shadow: 0 14px 30px rgba(1,174,94,.35);
}
.reg-done-title { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.reg-done-text { margin: 0 0 20px; color: #4E6A5C; line-height: 1.5; }
body.dark-theme .login-register, body.dark-theme .reg-back { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #5FD99A; }
body.dark-theme .login-register span, body.dark-theme .reg-done-text { color: var(--text-secondary); }
body.dark-theme .reg-grade, body.dark-theme .reg-chip { background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.12); color: var(--text-main); }

/* Эмблема и девиз слева от карточки — только index.html, только на широком
   экране; на телефоне — эмблема над карточкой */
.login-hero-title, .login-hero-text { display: none; }
@media (min-width: 900px) {
  .login-main .app-login-hero { display: flex; flex-direction: column; align-items: flex-start; width: 400px; animation: loginUp .8s var(--ease) both; }
  .login-main .app-login-hero img { width: 290px; border-radius: 26px; box-shadow: 0 24px 60px rgba(1,174,94,.3); }
  .login-main .login-hero-title { display: block; margin: 26px 0 0; font-size: 40px; font-weight: 900; line-height: 1.06; letter-spacing: -1px;
    background: linear-gradient(90deg, #0B7A4B, #0DA8A0, #6B4FE0); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .login-main .login-hero-text { display: block; margin: 12px 0 0; font-size: 16px; line-height: 1.5; color: #4E6A5C; }
  .login-main .login-hero-app { display: none; }
}
@media (max-width: 899px) {
  .login-main { flex-direction: column; justify-content: flex-start; gap: 22px; padding-top: 34px; }
  .login-main .app-login-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
  .login-main .app-login-hero img { width: 180px; border-radius: 22px; box-shadow: 0 20px 50px rgba(1,174,94,.3); }
  .login-main .login-hero-app { margin: 0; font-size: 15px; color: #4E6A5C; }
  .login-wrap::after { width: 140px; height: 140px; right: -40px; bottom: 4%; }
}

/* Тёмная тема: тот же перелив, но приглушённый, карточка — тёмное стекло */
body.dark-theme .login-wrap { background: #0E1712; }
body.dark-theme .login-wrap::before { opacity: .28; }
body.dark-theme .login-wrap::after { background: linear-gradient(140deg, rgba(255,255,255,.12), rgba(255,255,255,.02)); box-shadow: none; }
body.dark-theme .login-card { background: rgba(22,38,29,.72); border-color: rgba(255,255,255,.1); color: var(--text-main); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
body.dark-theme .login-title { color: var(--text-main); }
body.dark-theme .login-subtitle, body.dark-theme .login-card .field-label, body.dark-theme .login-main .login-hero-text, body.dark-theme .login-main .login-hero-app { color: var(--text-secondary); }
body.dark-theme .login-card .field-input { background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.12); color: var(--text-main); }
body.dark-theme .lang-toggle, body.dark-theme .login-branch-toggle-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
body.dark-theme .login-branch-menu { background: #16261D; border-color: rgba(255,255,255,.1); }
body.dark-theme .login-branch-menu a { color: var(--text-main); border-color: rgba(255,255,255,.08); }
body.dark-theme .login-branch-menu a:hover { background: rgba(255,255,255,.06); }


.field-label {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  background: var(--bg);
  /* Без явного color браузер подставляет свой чёрный — в тёмной теме
     введённый текст становится нечитаемым на тёмном фоне. */
  color: var(--text-main);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field-input::placeholder { color: var(--text-secondary); opacity: 0.7; }

/* Чтобы системные элементы полей (календарь у type=date, стрелка у select,
   каретка) тоже рисовались в тон теме, а не всегда светлыми */
body { color-scheme: light; }
body.dark-theme { color-scheme: dark; }

.field-input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--green-light);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
  box-shadow: var(--shadow-sm);
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  pointer-events: none;
}

.btn-primary:active::after { opacity: 1; transform: scale(1.4); transition: none; }

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.btn-primary:disabled::after { display: none; }

.login-error {
  color: var(--red);
  font-size: 13px;
  margin: -8px 0 14px;
  min-height: 16px;
}
.login-error.ok { color: var(--green-dark); font-weight: 600; }

.status-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 500;
  white-space: nowrap;
}

.status-paid { background: var(--green-light); color: var(--green-dark); }
.status-partial { background: var(--yellow-light); color: var(--yellow); }
.status-unpaid { background: var(--red-light); color: var(--red); }
.status-excluded { background: var(--border); color: var(--text-secondary); }

/* ---- App shell (dashboard pages) ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(11, 61, 38, 0.02);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
  cursor: default;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.app-logo:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}

.app-logo::after {
  content: "Nihol Academy";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translate(4px, -50%) scale(0.9);
  transform-origin: left center;
  background: var(--green-deep);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 7px 14px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
  z-index: 30;
}

.app-logo:hover::after {
  opacity: 1;
  transform: translate(10px, -50%) scale(1);
}

.app-logo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s var(--ease); }
.app-logo:hover img { transform: scale(1.1); }

.app-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0; color: var(--green-deep); }
.app-role { font-size: 12px; color: var(--text-secondary); margin: 0; }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn-logout:hover { background: var(--bg); border-color: var(--green); color: var(--green-deep); }

.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.section-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 44px;
}

/* ---- Дашборд в две колонки — меньше прокрутки на широких экранах ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
  margin-bottom: 44px;
  align-items: start;
}

.dashboard-col .cards-grid,
.dashboard-col .section-label:first-child {
  margin-top: 0;
}

@media (max-width: 860px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ---- Список "По способу оплаты за месяц" ---- */
.method-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.method-stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.method-stat-row:first-child { padding-top: 0; }

.method-stat-name {
  font-weight: 600;
  font-size: 14px;
}

.method-stat-values {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 500;
}

.method-stat-income { color: var(--green-dark); }
.method-stat-expense { color: var(--red); }

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
  animation: fadeInUp 0.45s var(--ease) both;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--green-light); }

.cards-grid .metric-card:nth-child(1) { animation-delay: 0.02s; }
.cards-grid .metric-card:nth-child(2) { animation-delay: 0.07s; }
.cards-grid .metric-card:nth-child(3) { animation-delay: 0.12s; }

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.metric-value {
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--green-deep);
}

.metric-value.danger { color: var(--red); }

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.nav-tile {
  display: block;
  text-decoration: none;
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
  animation: fadeInUp 0.45s var(--ease) both;
}
.nav-tile:hover { border-color: var(--green); background: var(--green-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.nav-tile.disabled {
  color: var(--text-secondary);
  cursor: default;
  opacity: 0.6;
}
.nav-tile.disabled:hover { border-color: var(--border); background: var(--surface); transform: none; box-shadow: var(--shadow-sm); }

.loading-text { color: var(--text-secondary); font-size: 13px; }

/* ---- Students page ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 26px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s var(--ease) both;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 18px;
  color: var(--green-deep);
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.form-row .field-input { margin-bottom: 0; }

.btn-small {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn-small:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-small:active { transform: translateY(0); }
/* Кнопка свой фон и белый текст задаёт сама, поэтому браузерного «серого»
   вида у выключенной кнопки не остаётся: она выглядит рабочей, человек жмёт
   и не понимает, почему ничего не происходит. Меняем только прозрачность,
   курсор и тень — фон (например, красный у штрафа) остаётся своим. */
.btn-small:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-row select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--surface);
  transition: border-color 0.15s var(--ease);
}
.filter-row select:hover { border-color: var(--green); }

.students-table {
  width: 100%;
  border-collapse: collapse;
}

.students-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.students-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.students-table tr:last-child td { border-bottom: none; }
.students-table tr { transition: background 0.12s var(--ease); }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--green-wash); }

.muted-small { font-size: 12px; color: var(--text-secondary); }

/* ---- Cashier page ---- */
.method-row {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.method-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.method-btn:hover:not(.active) { background: var(--bg); border-color: var(--green); }
.method-btn.active { background: var(--green); color: #fff; border-color: var(--green); box-shadow: var(--shadow-sm); }
.method-btn:disabled { cursor: default; opacity: 0.5; }
.method-btn:disabled.active { opacity: 1; }
.method-btn:disabled:hover { background: var(--surface); }

.autocomplete-wrap { position: relative; }

.autocomplete-list {
  position: absolute;
  top: calc(100% - 12px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.15s var(--ease) both;
}

.autocomplete-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s var(--ease);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--green-light); }
.autocomplete-item .ac-class { color: var(--text-secondary); font-size: 12px; margin-left: 6px; }
/* полоска слева: в тёмной теме фон подсветки почти не отличается от фона списка */
.autocomplete-item.active { background: var(--green-light); box-shadow: inset 3px 0 0 var(--green); }

.student-summary {
  background: var(--green-wash);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
}
.summary-row.total {
  font-weight: 600;
  font-size: 14px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}
.summary-label { color: var(--text-secondary); }

.tx-list { margin-top: 4px; }

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tx-row:last-child { border-bottom: none; }
.tx-row.cancelled { opacity: 0.55; }

.tx-info { display: flex; flex-direction: column; gap: 2px; }
.tx-name { font-weight: 500; }
.tx-meta { font-size: 12px; color: var(--text-secondary); }
.tx-amount { font-weight: 600; color: var(--green-dark); }
.tx-amount.cancelled-amount { text-decoration: line-through; color: var(--text-secondary); }

.btn-cancel-tx {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--red);
  cursor: pointer;
  margin-left: 10px;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
}
.btn-cancel-tx:hover { background: var(--red-light); }
/* Заблокированная опасная кнопка должна выглядеть заблокированной: иначе
   подтверждение вводом теряет смысл — человек жмёт и не понимает, почему
   ничего не происходит. */
.btn-cancel-tx:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--text-secondary);
}
.btn-cancel-tx:disabled:hover { background: none; }

/* Кнопка в ячейке таблицы: свои вертикальные отступы .btn-ghost-small
   рассчитаны на форму, в строке они разгоняют её по высоте. */
.td-actions .btn-ghost-small { margin: 4px 0 0; }

/* ---- Поле пароля со скрытием и кнопкой "показать" ---- */
.password-field { position: relative; }

/* Отступ снимаем с самого поля: иначе он схлопывается с отступом кнопки ниже
   и она наезжает на поле. Расстояние задаёт .btn-ghost-small. */
.password-field .field-input {
  padding-right: 42px;
  margin-bottom: 0;
}

.password-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}
.password-toggle:hover { opacity: 1; background: var(--bg); }
.password-toggle.is-visible { opacity: 1; }

/* Небольшая нейтральная кнопка (в отличие от красной .btn-cancel-tx) */
.btn-ghost-small {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  margin: 8px 0 16px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.btn-ghost-small:hover { background: var(--green-light); color: var(--green-deep); }
/* То же и здесь: «Напечатать ещё раз» и «Скачать PDF» в кассе до первой
   оплаты выключены, но подсвечивались при наведении как живые. */
.btn-ghost-small:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost-small:disabled:hover { background: none; color: var(--text-secondary); }

/* «Вернуться в систему» в QR-форме: крупная кнопка под палец, а не ссылка
   мелким шрифтом — учитель открывает форму с телефона. */
.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--green);
  background: var(--surface);
  color: var(--green-deep);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn-back:hover { background: var(--green-light); }
.btn-back:active { transform: translateY(1px); }
.btn-back-arrow { font-size: 22px; line-height: 1; }

/* Метка «new» у имени ученика — за него ещё не было ни одной оплаты
   (isNewStudent в js/common.js). */
.badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}
body.dark-theme .badge-new { color: #06301F; }
/* В тёмной теме зелёный становится ярким (#1FD478), и белые надписи на нём
   почти не читаются (контраст около 2). Везде, где фон — зелёный, пишем
   тем же тёмным цветом, что и на метке «новое». */
body.dark-theme .lang-toggle-btn.active,
body.dark-theme .btn-primary,
body.dark-theme .btn-small,
body.dark-theme .method-btn.active,
body.dark-theme .tab-btn.active,
body.dark-theme .sidebar-link.active,
body.dark-theme .rem-voice-lang-btn.active,
body.dark-theme .tr-toggle-btn.active,
body.dark-theme .pull-refresh-hint,
body.dark-theme .app-logo::after,
body.dark-theme .chip-edit:hover { color: #06301F; }
/* В строках-флексах метка стоит рядом с именем, а не внутри него: имя там
   обрезается многоточием, и метку отрезало бы вместе с концом имени. */
.attd-row > .badge-new, .pick-item > .badge-new { margin-left: 0; flex: none; }

/* Дашборд: «Пришли в школу сегодня» — всего, а ниже по языку классов. */
.dash-came { margin-bottom: 44px; }
.dash-came .metric-value { font-size: 34px; }
.dash-came-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.dash-came-split .metric-label { margin-bottom: 2px; }
.dash-came-num { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-main); }
.dash-came-link { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--green-dark); text-decoration: none; }
.dash-came-link:hover { text-decoration: underline; }

/* ---- Зарплатная ведомость (payroll.html) и окно премий/штрафов ---- */
.pay-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; font-size: 13px; color: var(--text-secondary); }
.pay-status-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pay-status-actions .btn-ghost-small { margin: 0; }
.pay-scroll { overflow-x: auto; }
.pay-table th.num, .pay-table td.num { text-align: right; white-space: nowrap; }
.pay-table .pay-plus { color: var(--green-dark); }
.pay-table .pay-minus { color: var(--red); }
.pay-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
.pay-details-row td { background: var(--green-wash); }
.pay-emp { color: var(--text-main); text-decoration: none; font-weight: 600; }
.pay-emp:hover { text-decoration: underline; }
.pay-dialog-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.45); }
.pay-dialog { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 20px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); }
.pay-dialog .field-input { margin-bottom: 12px; }
.pay-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.pay-dialog-actions .btn-ghost-small { margin: 0; }

/* Ведомость: широкой таблице — больше места, чем обычной странице */
.sidebar-content.pay-wide { max-width: 1320px; }
.pay-note { margin: 0 0 10px; }
.pay-table th, .pay-table td { padding-left: 7px; padding-right: 7px; }
.pay-table td { font-size: 13px; vertical-align: top; }
.pay-table td.num { font-variant-numeric: tabular-nums; }
.pay-sub { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--text-secondary); white-space: nowrap; }
.pay-table td.pay-cell-edit { cursor: pointer; border-radius: 6px; }
.pay-table td.pay-cell-edit:hover,
.pay-table td.pay-cell-edit:focus-visible { background: var(--green-wash); box-shadow: inset 0 0 0 1px var(--green); outline: none; }
.pay-set-salary { color: var(--green-dark); font-weight: 600; text-decoration: underline dotted; }
.pay-remaining { color: var(--red); font-weight: 600; }
.pay-table tr.pay-open > td { background: var(--green-wash); }
.btn-cancel-tx.pay-edit-btn { margin-left: 0; color: var(--green-dark); }
.btn-cancel-tx.pay-edit-btn:hover { background: var(--green-wash); }
/* «Убрать из ведомости» — маленький крестик рядом с «Изменить» */
.btn-cancel-tx.pay-off-btn { margin-left: 4px; padding-left: 9px; padding-right: 9px; color: var(--text-secondary); }
.btn-cancel-tx.pay-off-btn:hover { color: var(--red); }
.pay-table .pay-editor-row > td { padding: 12px 14px 16px; background: var(--green-wash); border-bottom: 2px solid var(--green); }
.pay-editor-calc { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.pay-editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pay-editor-box { padding: 12px; border: 1px solid var(--border); border-top: 3px solid var(--text-secondary); border-radius: 12px; background: var(--surface); }
.pay-editor-box.bonus { border-top-color: var(--green); }
.pay-editor-box.penalty { border-top-color: var(--red); }
.pay-editor-box .field-label { margin-bottom: 6px; }
.pay-editor-box .field-input { margin-bottom: 8px; }
.pay-editor-box .btn-small { width: 100%; margin: 0; }
.pay-editor-box.penalty .btn-small,
.pay-editor-box.penalty .btn-small:hover { background: var(--red); }
.pay-editor-hint { margin: -2px 0 8px; font-size: 11px; line-height: 1.4; color: var(--text-secondary); }
.pay-editor-msg { min-height: 18px; margin: 10px 0 0; font-size: 13px; }
.pay-editor-msg.ok { color: var(--green-dark); }
.pay-editor-msg.err { color: var(--red); }
.pay-editor-items { margin-top: 14px; }
.pay-editor-items .field-label { margin: 0 0 6px; }
.pay-editor-items .tx-row { background: var(--surface); }
.pay-fix-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.pay-fix-form .field-input { flex: 1 1 180px; margin: 0; }
.pay-fix-form .field-input[type="number"], .pay-fix-form .field-input[data-money] { flex: 0 1 130px; }   /* сумма: js/money-input.js делает поле text — селектор по type перестал бы совпадать */
.pay-fix-form .btn-small,
.pay-fix-form .btn-ghost-small { margin: 0; }
@media (max-width: 640px) {
  .pay-table .pay-editor-row > td { display: block; padding: 10px 0 0; text-align: left; background: none; border-bottom: none; }
  .pay-table .pay-editor-row > td::before { content: none; }
  .pay-table tr:not(.pay-editor-row) > td > div { text-align: right; }
}

/* Двойники сотрудников (отдел кадров) */
/* Список сотрудников — как список учеников (js/hr.js hrEmployeeRow) */
.hr-group-row td { background: var(--bg); font-weight: 700; padding: 8px 12px; }
.hr-who { display: flex; align-items: center; gap: 8px; }
.hr-who-text { min-width: 0; }
.hr-who-text .muted-small { display: block; margin-top: 2px; }
.hr-nw { white-space: nowrap; }
.hr-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.hr-btns .btn-cancel-tx { margin: 0; }
@media (max-width: 640px) {
  /* на телефоне строка — карточка: фото справа, текст прижат вправо, как значения остальных полей */
  .hr-who { flex-direction: row-reverse; text-align: right; }
  #employeesBody td > div { text-align: right; }
  #employeesBody .hr-btns { gap: 6px; justify-content: flex-start; }
  /* должность — подписью над карточками своей группы, а не ещё одной карточкой */
  .students-table tr.hr-group-row { border: none; box-shadow: none; background: none; padding: 0 2px; margin: 16px 0 6px; }
  .students-table tr.hr-group-row td { display: block; text-align: left; padding: 0; border: none; background: none; font-size: 14px; }
  .students-table tr.hr-group-row td .muted-small { white-space: nowrap; }
  .students-table tr.hr-group-row td::before { content: none; }
}
.hr-dup-count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--red-light); color: var(--red); font-size: 12px; font-weight: 700; text-align: center; vertical-align: middle; }
.hr-dup-group { padding: 12px 0; border-top: 1px solid var(--border); }
.hr-dup-group:first-child { padding-top: 0; border-top: none; }
.hr-dup-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.hr-dup-card { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.hr-dup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.hr-dup-actions .btn-small,
.hr-dup-actions .btn-ghost-small { margin: 0; }
.hr-merge-choices { display: flex; flex-direction: column; gap: 8px; }
.hr-merge-choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.hr-merge-choice input { margin-top: 12px; }
.hr-merge-choice .hr-dup-card { flex: 1; }
.hr-merge-choice input:checked + .hr-dup-card { border-color: var(--green); background: var(--green-wash); box-shadow: inset 0 0 0 1px var(--green); }

/* Поиск по списку — одинаковый на всех страницах со списками */
.list-search {
  width: auto;
  min-width: 200px;
  margin-bottom: 0;
}
@media (max-width: 640px) {
  .list-search { width: 100%; min-width: 0; }
}

.day-total {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 0 0;
  margin-top: 6px;
  border-top: 2px solid var(--border);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.month-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.month-checkbox.mc-paid { background: var(--green-light); border-color: var(--green); }
.month-checkbox.mc-partial { background: var(--yellow-light); border-color: var(--yellow); }
.month-checkbox.mc-unpaid { background: var(--surface); }
.month-checkbox input { margin: 0; }
.month-checkbox .mc-label { display: flex; flex-direction: column; gap: 2px; }
.month-checkbox .mc-name { font-weight: 600; }
.month-checkbox .mc-amt { color: var(--text-secondary); }
.month-checkbox .mc-adj { font-size: 11px; font-weight: 600; }

/* ---- «Автобус» (bus.html, js/bus.js): цена, список с оплатой по месяцам, «Не оплатили» ----
   Клетки месяцев в строке списка красятся теми же классами, что сетка оплат
   в кассе выше (mc-paid / mc-partial / mc-unpaid), — один цвет на всю систему. */
/* Вкладки и учебный год — одной строкой над обоими разделами */
.bus-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.bus-top .tab-row { margin-bottom: 0; }
.bus-top .field-label { margin: 0; }
.bus-top select.field-input { width: auto; margin: 0; }
.bus-fail { border-color: var(--red); }
.bus-fail .panel-title { color: var(--red); }
/* Заметная подсказка: цена не задана, ребёнок уже в списке */
.bus-warn { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--yellow); border-radius: 10px; background: var(--yellow-light); font-size: 14px; line-height: 1.5; }
.bus-ok { margin: 8px 0 0; font-size: 13px; color: var(--green-dark); }
.bus-ok:empty { display: none; }
.bus-price-now { margin: 0 0 14px; font-size: 15px; }
.bus-price-big { font-size: 24px; font-weight: 700; color: var(--green-deep); }
.bus-price-history { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.bus-price-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 3px 0; font-size: 13px; color: var(--text-secondary); }
.bus-price-row.is-now { color: var(--text-main); }
.bus-price-row .btn-cancel-tx { margin-left: 0; padding: 3px 8px; }
/* Подсказки поиска выпадают за нижний край панели: без этого их накрывала бы
   следующая панель (у каждой панели свой слой из-за анимации появления) */
.bus-add-panel { position: relative; z-index: 2; }
.bus-chosen { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--green); border-radius: 10px; background: var(--green-wash); }
.bus-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bus-btns .btn-cancel-tx, .bus-btns .btn-ghost-small, .bus-btns .btn-small { margin: 0; }
.bus-ac-mark { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: var(--border); color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.autocomplete-item.bus-ac-taken, .autocomplete-item.bus-ac-none { color: var(--text-secondary); }
.autocomplete-item.bus-ac-none { cursor: default; }
/* Список */
.bus-table td { vertical-align: middle; }
/* поля ячеек у́же обычных, как в ведомости: на ноутбуке с открытым меню строка помещается без прокрутки вбок */
.bus-table th, .bus-table td { padding-left: 7px; padding-right: 7px; }
.bus-who { min-width: 140px; }
.bus-name { font-weight: 600; }
.bus-nw { white-space: nowrap; }
.bus-debt { color: var(--red); white-space: nowrap; }
.bus-months { display: grid; grid-template-columns: repeat(10, minmax(30px, 1fr)); gap: 3px; min-width: 327px; max-width: 480px; }
/* «Изменить» и «Не ездит с…» — в одну строку, «Удалить» — под ними: строка списка не растёт втрое */
.bus-table td.td-actions .bus-btns { min-width: 178px; }
.bus-mc { display: block; padding: 6px 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font: inherit; font-size: 11px; line-height: 1.2; text-align: center; color: var(--text-main); cursor: pointer; }
.bus-mc.mc-paid { background: var(--green-light); border-color: var(--green); }
.bus-mc.mc-partial { background: var(--yellow-light); border-color: var(--yellow); }
/* не оплачено, а месяц уже наступил — это долг; будущий месяц остаётся обычным */
.bus-mc.bus-mc-late { background: var(--red-light); border-color: var(--red); color: var(--red); }
.bus-mc.bus-mc-none { border-style: dashed; color: var(--text-secondary); opacity: 0.55; }
.bus-mc.is-open { box-shadow: 0 0 0 2px var(--green-deep); }
.bus-mc:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.bus-month-note { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.bus-month-note:empty { display: none; }
.bus-row-gone .bus-name, .bus-row-idle .bus-name { color: var(--text-secondary); }
.bus-row-idle .bus-months { opacity: 0.6; }
.bus-row-flash > td { background: var(--green-light); }
.bus-group-row td { background: var(--bg); font-weight: 700; padding: 8px 12px; }
.bus-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 14px 0 0; font-size: 12px; color: var(--text-secondary); }
.bus-legend .bus-mc { display: inline-block; width: 14px; height: 14px; padding: 0; vertical-align: -2px; cursor: default; }
.bus-summary { margin: 12px 0 0; font-weight: 600; font-size: 14px; }
.bus-summary:empty { display: none; }
/* Окна «Изменить» и «Не ездит с…»: что изменит правка */
.bus-preview { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.bus-preview:empty { display: none; }
/* Цена ребёнка: общая или своя (форма «Добавить», окно «Изменить», колонка «Цена» списка) */
.bus-own { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 0; }
.bus-own .bus-own-title { margin: 0; }
.bus-own-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.bus-own-opt input { margin: 0; }
.bus-own-fields { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 14px; }
.bus-own-fields .field-input { width: auto; max-width: 100%; margin: 0; }
.bus-own-fields input.field-input { width: 150px; }
.bus-own-fields .bus-own-from-label { margin: 0; font-size: 14px; }
.bus-own-hint { margin: 6px 0 12px; line-height: 1.5; }
.bus-own-hint:empty { display: none; }
.bus-own-history { margin-top: 8px; }
.bus-own-history:empty { display: none; }
.bus-price-row.is-removed > span:first-child { text-decoration: line-through; }
.bus-own-tag { white-space: nowrap; }
/* «Не оплатили»: карточка на класс */
.bus-unpaid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.bus-unpaid-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.bus-unpaid-class { margin: 0 0 8px; font-weight: 700; }
.bus-unpaid-card ol { margin: 0; padding-left: 22px; line-height: 1.7; font-size: 14px; }
.bus-unpaid-line { display: flex; justify-content: space-between; gap: 12px; }
@media (max-width: 640px) {
  .bus-top select.field-input { flex: 1 1 120px; }
  /* на телефоне строка — карточка (правило .students-table ниже): клетки месяцев —
     два ряда по пять на всю ширину, подпись колонки над ними */
  .students-table td.bus-months-cell { flex-direction: column; align-items: stretch; gap: 6px; text-align: left; }
  .bus-months { grid-template-columns: repeat(5, minmax(0, 1fr)); min-width: 0; max-width: none; gap: 4px; }
  .bus-mc { padding: 9px 0; font-size: 12px; }
  .bus-legend .bus-mc { padding: 0; }
  .bus-who { min-width: 0; text-align: right; }
  .bus-table td > div:not([class]) { text-align: right; }
  .bus-table td.td-actions .bus-btns { min-width: 0; gap: 8px; }
  /* «в этом году не ездят» — подписью над своими карточками, а не ещё одной карточкой */
  .students-table tr.bus-group-row { border: none; box-shadow: none; background: none; padding: 0 2px; margin: 16px 0 6px; }
  .students-table tr.bus-group-row td { display: block; text-align: left; padding: 0; border: none; background: none; font-size: 14px; }
  .students-table tr.bus-group-row td::before { content: none; }
}

/* ---- Панель «Сумма за учёбу» (students.html) ---- */
.tuition-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.tuition-name { flex: 1; min-width: 120px; font-size: 14px; }
.tuition-amount { width: 130px; margin-bottom: 0; text-align: center; }
.tuition-discount { width: 90px; margin-bottom: 0; text-align: center; }
.tuition-due { width: 110px; text-align: right; white-space: nowrap; }
/* Подпись режима длинная; без ограничения select распирает панель наружу. */
#tuitionMode { max-width: 100%; }

/* ---- Выбор нескольких учеников (начисление coin) ---- */
.pick-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pick-head .btn-ghost-small { margin: 0; }
.pick-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: auto;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  /* Класс из тридцати человек не должен отодвигать поля «Количество» и
     «Причина» за нижний край экрана — список прокручивается внутри себя. */
  max-height: 320px;
  overflow-y: auto;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pick-item:hover { border-color: var(--green); }
.pick-item.is-checked {
  background: var(--green-light);
  border-color: var(--green);
  /* В тёмной теме --green-light почти неотличим от --surface (контраст 1.01),
     поэтому выбранного ученика отмечает не заливка, а утолщённая рамка и цвет
     имени: перед массовым списанием видно, кто именно отмечен. */
  box-shadow: inset 0 0 0 1px var(--green);
}
.pick-item.is-checked .pick-name { color: var(--green-deep); }
.pick-item input { margin: 0; flex-shrink: 0; }
.pick-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-balance { font-weight: 600; color: var(--green-deep); flex-shrink: 0; }

.tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab-btn:hover:not(.active) { color: var(--text-main); }
.tab-btn.active { background: var(--green); color: #fff; }

/* ============================================================
   Адаптивность (телефоны и узкие экраны)
   ============================================================ */
@media (max-width: 640px) {

  .app-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .app-title { font-size: 14px; }
  .app-role { font-size: 11px; }

  .btn-logout {
    padding: 7px 12px;
    font-size: 12px;
  }

  .app-main {
    padding: 16px 12px 40px;
  }

  .panel {
    padding: 14px;
    margin-bottom: 16px;
  }

  .panel-title { font-size: 14px; }

  /* Формы: любая сетка колонок схлопывается в одну колонку */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .form-row .btn-small {
    width: 100%;
  }

  .field-input {
    font-size: 16px; /* не даёт iOS автоматически зумить при фокусе на поле */
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card { padding: 14px; }
  .metric-value { font-size: 20px; }
  .metric-label { font-size: 12px; }

  /* Пальцем в кнопку высотой 26px не попасть — увеличиваем зону нажатия */
  .btn-ghost-small { min-height: 40px; padding: 8px 14px; }

  .nav-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-tile {
    padding: 14px 10px;
    font-size: 13px;
  }

  /* Таблицы на мобильном: превращаем строки в карточки вместо листания вбок */
  .students-table thead { display: none; }

  .students-table, .students-table tbody, .students-table tr, .students-table td {
    display: block;
    width: 100%;
  }

  .students-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 10px 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  .students-table tr:last-child { margin-bottom: 0; }

  .students-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
    text-align: right;
  }
  .students-table td:last-child { border-bottom: none; }

  .students-table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    flex-shrink: 0;
    font-size: 12px;
  }

  .students-table td:empty,
  .students-table td:not([data-label]):not([colspan]) { display: none; }

  .students-table td.td-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .students-table td.td-actions::before { margin-bottom: 2px; }
  .students-table td.td-actions .btn-cancel-tx { margin-left: 0; }
  .students-table td.td-actions .btn-ghost-small { margin: 0; }

  .month-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* На телефоне имя ученика зажималось в ноль между полями — переносим его
     на отдельную строку, поля остаются в ряд под ним. */
  .tuition-row { flex-wrap: wrap; }
  .tuition-name { flex: 1 1 100%; min-width: 0; }
  /* База 90px, а не auto: перенос строки flex решает по базе, и при 110px
     «в месяц» уезжало на третью строку. */
  .tuition-amount { flex: 1 1 90px; width: auto; min-width: 0; }
  .tuition-discount { flex: 0 0 84px; width: 84px; }
  .tuition-due { flex: 0 0 auto; width: auto; }

  .pick-grid {
    /* Одна колонка и minmax(0, ...): при 1fr с автоминимумом колонка
       растягивается по самому длинному имени и сетка вылезает за панель. */
    grid-template-columns: minmax(0, 1fr);
    max-height: 260px;
  }

  .tab-row {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .tx-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  .day-total, .summary-row {
    font-size: 13px;
  }

  .autocomplete-list {
    max-height: 180px;
  }
}

@media (max-width: 420px) {
  .cards-grid, .nav-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   НОВЫЙ МАКЕТ: боковое меню слева (пока только на admin.html)
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Мобильная верхняя панель с гамбургером — видна только на узких экранах ---- */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.hamburger-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-main);
  padding: 4px 8px;
  line-height: 1;
}

.mobile-topbar-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.mobile-topbar-logo img { width: 100%; height: 100%; object-fit: cover; }

.mobile-topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--green-deep);
}

/* ---- Боковое меню ---- */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  margin: 0;
  color: var(--green-deep);
}
.sidebar-role {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.sidebar-branch-switcher {
  position: relative;
  margin: -4px 0 14px;
}
.sidebar-branch-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.sidebar-branch-toggle:hover { border-color: var(--green); background: var(--surface); }
.sidebar-branch-arrow { font-size: 10px; }
.sidebar-branch-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 60;
  overflow: hidden;
}
.sidebar-branch-link {
  display: block;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sidebar-branch-link:last-child { border-bottom: none; }
.sidebar-branch-link:hover { background: var(--green-light); }

.sidebar-search {
  position: relative;
  margin-bottom: 14px;
}

.sidebar-search-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--bg);
  color: var(--text-main);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.sidebar-search-input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--surface);
}

.sidebar-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
  z-index: 60;
}

.sidebar-search-result-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sidebar-search-result-item:last-child { border-bottom: none; }
.sidebar-search-result-item:hover { background: var(--green-light); }

.sidebar-search-result-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.sidebar-search-result-label { font-size: 13px; color: var(--text-main); font-weight: 500; }

.sidebar-search-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.sidebar-link:hover {
  background: var(--green-light);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.sidebar-logout {
  margin-top: 16px;
  width: 100%;
}

.sidebar-lang-toggle {
  position: static;
  justify-content: center;
  margin-top: 20px;
  background: var(--green-light);
}

/* ---- Основной контент рядом с меню ---- */
.sidebar-content {
  flex: 1;
  min-width: 0;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 45;
}

/* ---- Мобильная адаптация нового меню ---- */
@media (max-width: 860px) {
  .mobile-topbar { display: flex; }

  .app-shell { display: block; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;   /* iPhone: 100vh — с убранной панелью Safari, и «Выйти» уходил под неё */
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.sidebar-open { transform: translateX(0); }

  .sidebar-backdrop.visible { display: block; }

  .sidebar-content { padding: 24px 16px 60px; max-width: none; }
}

/* ---- Виджет "Оплата по классам" ---- */
.class-payment-row {
  margin-bottom: 14px;
}
.class-payment-row:last-child { margin-bottom: 0; }

.class-payment-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}
.class-payment-label .class-name { font-weight: 600; }
.class-payment-label .class-fraction { color: var(--text-secondary); }

.class-payment-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border);
}
.class-payment-bar .seg-paid { background: var(--green); }
.class-payment-bar .seg-partial { background: var(--yellow); }
.class-payment-bar .seg-unpaid { background: var(--red); opacity: 0.55; }

/* ---- Виджет "Топ должников" ---- */
.debtor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.debtor-row:last-child { border-bottom: none; padding-bottom: 0; }
.debtor-row:first-child { padding-top: 0; }
.debtor-name { font-weight: 500; font-size: 14px; }
.debtor-class { color: var(--text-secondary); font-size: 12px; }
.debtor-amount { color: var(--red); font-weight: 600; font-size: 14px; }

/* ============================================================
   Премиальный переход между страницами (логотип увеличивается
   и исчезает при клике на пункт бокового меню)
   ============================================================ */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.page-transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.page-transition-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.3);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s var(--ease);
}

.page-transition-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-transition-overlay.active .page-transition-logo {
  transform: scale(1);
  opacity: 1;
}

.page-transition-overlay.leaving .page-transition-logo {
  transform: scale(1.7);
  opacity: 0;
  transition: transform 0.32s var(--ease), opacity 0.32s var(--ease);
}

.sidebar-brand:hover .sidebar-logo {
  transform: scale(1.06);
}

/* ---- Домашняя страница (логотип → сюда) ---- */
.home-page {
  flex: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(160deg, rgba(2, 62, 67, 0.45) 0%, rgba(1, 20, 22, 0.72) 100%),
    url('../img/home-bg.jpg') center / cover no-repeat;
}

.home-welcome {
  text-align: center;
  animation: fadeInUp 0.6s var(--ease) both;
}

.home-welcome-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  overflow: hidden;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-lg);
}
.home-welcome-logo img { width: 100%; height: 100%; object-fit: cover; }

.home-welcome-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px;
}

.home-welcome-subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  margin: 0;
}

/* ---- Расписание уроков ---- */
.two-col-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.two-col-panels .panel { margin-bottom: 0; }

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--green-light);
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 500;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(1, 174, 94, 0.16);
  color: var(--green-deep);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.chip-remove:hover { background: var(--red); color: #fff; }

.chip-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(1, 174, 94, 0.16);
  color: var(--green-deep);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.chip-edit:hover { background: var(--green-deep); color: #fff; }

/* Язык обучения прямо в фишке класса */
.chip-lang {
  margin-left: 8px;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.chip-lang:hover { border-color: var(--green); }

.schedule-grid-wrap {
  overflow-x: auto;
  margin-top: 4px;
}

.schedule-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.schedule-table th {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.schedule-table th:first-child { text-align: left; }

.schedule-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  min-width: 110px;
}

.schedule-table td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary);
  border-left: none;
  min-width: 40px;
}

.schedule-table tr:last-child td { border-bottom: none; }

.schedule-cell-subject { font-weight: 600; color: var(--text-main); }
.schedule-cell-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.schedule-cell-empty { color: var(--border); }

/* ---- Правка рабочего времени прямо в ячейке (staff-schedule.html) ---- */
/* 110px (общее правило для расписаний) давали 905px при 854px панели —
   неделя не влезала и уезжала в горизонтальную прокрутку. 100px хватает
   на «09:00–18:00», зато вся неделя видна сразу. */
/* Селектор с `td` обязателен: общее `.schedule-table td` (класс + элемент)
   по специфичности перебивает одиночный класс, и min-width не применялся. */
.schedule-table td.staffsched-cell { min-width: 100px; }
.staffsched-cell { cursor: pointer; transition: background 0.15s var(--ease); }
/* В тёмной теме --green-light почти совпадает с фоном, поэтому одной заливкой
   наведение не показать — добавляем пунктирную рамку (сплошная зарезервирована
   под подтверждение записи, чтобы их не путать). */
.staffsched-cell:hover { background: var(--green-light); outline: 1px dashed var(--green); outline-offset: -1px; }
/* Пустая ячейка тоже кликабельна — прочерк не должен быть почти невидимым. */
.staffsched-cell .schedule-cell-empty { color: var(--text-secondary); opacity: 0.6; }
.staffsched-cell:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.staffsched-cell.is-editing { background: var(--green-light); }
/* Короткая зелёная вспышка после записи: подтверждение без всплывающих окон. */
.staffsched-cell.just-saved { background: var(--green-light); box-shadow: inset 0 0 0 1px var(--green); }

.staffsched-input {
  width: 100%;
  min-width: 90px;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}
.staffsched-input:focus { outline: none; box-shadow: 0 0 0 3px var(--green-light); }

.schedule-table td.staffsched-namecell {
  text-align: left;
  min-width: 150px;
  line-height: 1.35;
}
.staffsched-empname { font-weight: 600; color: var(--text-main); }
.staffsched-namecell .btn-ghost-small { margin: 6px 0 0; }

@media (max-width: 860px) {
  .two-col-panels {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ---- Чаты (класс / школа) ---- */
.chat-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chat-header-row select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--surface);
}

.chat-children-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Электронный журнал ---- */
.journal-lesson-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.journal-lesson-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--green-wash);
}

.journal-lesson-subject {
  font-weight: 600;
  font-size: 14px;
  margin-right: 8px;
}

.journal-lesson-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.journal-lesson-body {
  padding: 14px 16px;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.journal-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.journal-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.journal-att-select { min-width: 150px; }
.journal-grade-input { width: 80px; }
/* Тема урока и домашнее задание над списком класса */
.journal-lesson-meta { display: grid; gap: 4px; margin-bottom: 14px; }
.journal-lesson-meta .field-input { margin-bottom: 6px; }
.journal-hw-input { resize: vertical; min-height: 54px; font: inherit; }

/* Журнал и экзамены на телефоне.
   Строки НЕ превращаем в карточки (как в .students-table): это сетка для
   ввода — учителю нужно видеть сразу много учеников и идти сверху вниз,
   а карточки растянули бы класс из 30 человек на 90 строк.
   Вместо этого ужимаем саму таблицу, чтобы она влезла в ширину экрана.
   Размер шрифта у полей не трогаем: 16px не даёт iOS зумить при фокусе. */
@media (max-width: 640px) {
  .journal-table th,
  .journal-table td {
    padding: 8px 4px;
  }
  .journal-table th:first-child,
  .journal-table td:first-child {
    word-break: break-word;
    line-height: 1.25;
  }
  .journal-att-select {
    min-width: 0;
    width: 100%;
    padding: 9px 4px;
  }
  .journal-grade-input {
    width: 100%;
    /* Должно хватать на подсказку "0–100" целиком: обрезанное "0–10"
       читается как другой максимальный балл */
    min-width: 62px;
    padding: 9px 4px;
    text-align: center;
  }
  /* Подстраховка: если содержимое всё же шире экрана, прокручивается
     сама таблица, а не вся страница */
  .journal-lesson-body { overflow-x: auto; }
}

/* ---- Канбан-доска (Приём: кандидаты) ---- */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-column {
  flex: 0 0 270px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 140px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.kanban-column.drag-over {
  border-color: var(--green);
  background: var(--green-wash);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kanban-count {
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease), opacity 0.15s var(--ease);
}

.kanban-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.4; }

.kanban-card-name { font-weight: 600; font-size: 13px; color: var(--text-main); margin-bottom: 3px; }
.kanban-card-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.5; }
.kanban-card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.kanban-move-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.kanban-move-btn:hover { background: var(--green-light); color: var(--green-dark); }

/* ---- Конструктор теста: вопросы и варианты ответа ---- */
.qb-question-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg);
}

.qb-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.qb-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.qb-option-row input[type="text"] { flex: 1; margin-bottom: 0; }
.qb-option-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }

/* ---- Конструктор теста: форма, классы, редактор (этап 4) ---- */
.form-row.qb-main-row { grid-template-columns: 1.6fr 1fr 1fr; margin-bottom: 12px; }
.qb-assign { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; background: var(--green-wash); }
.qb-assign-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 8px; }
.qb-class-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 10px; }
.qb-grade-group { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qb-grade-btn, .qb-class-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-main);
  border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer;
}
.qb-grade-btn { font-weight: 700; color: var(--text-secondary); border-style: dashed; }
.qb-class-chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
body.dark-theme .qb-class-chip.on { color: #06301F; }
.qb-assign-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 20px; }
.qb-level { flex: 1 1 220px; min-width: 0; }
.qb-level .field-input { margin-bottom: 0; }
.qb-active-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; padding: 8px 0; }
.qb-active-toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.qb-attempts-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.qb-attempts-note .btn-small { flex: 0 0 auto; }
.qb-draft-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--green-light); color: var(--green-deep); font-size: 14px; }
.qb-draft-actions { display: inline-flex; gap: 8px; }
.qb-draft-actions .btn-ghost-small { margin: 0; }
.qb-q-tools { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.kanban-move-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.qb-question-block.qb-q-bad { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-light); }
.qb-q-problem { margin: 8px 0 0; color: var(--red); font-size: 13px; font-weight: 600; }
.qb-question-block textarea.field-input { resize: vertical; min-height: 40px; line-height: 1.4; font-family: inherit; }
.qb-options-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 4px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.qb-correct-head { order: -1; min-width: 70px; }
.qb-option-row { border-radius: 8px; padding: 2px 4px; }
.qb-option-row.correct { background: var(--green-light); }
.qb-option-row.correct input[type="text"] { border-color: var(--green); }
.qb-letter.correct { color: var(--green-dark); }
.qb-add-passage { margin: 0 0 8px; }
.qb-save-row { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.qb-save-note { color: var(--green-dark); font-weight: 700; font-size: 14px; }
.qb-err-line { display: block; }
.qb-test-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qb-test-actions .btn-ghost-small, .qb-test-actions .btn-cancel-tx { margin: 0; }
.qb-test-row .tx-name .status-badge { margin-left: 6px; font-size: 11px; padding: 2px 8px; vertical-align: middle; }
.qb-paste-summary { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--yellow-light); color: var(--yellow-deep); font-size: 13px; font-weight: 600; }
#qbArchiveToggleBtn.active { background: var(--green-light); color: var(--green-dark); }

/* ---- Полноэкранный режим прохождения теста (киоск) ---- */
.quiz-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  overflow-y: auto;
  padding: 24px 16px 60px;
}

/* Экран прохождения теста по ссылке: фон вместо пустой заливки. Затемняющий
   градиент сверху — чтобы карточки вопросов читались на любой фотографии. */
.quiz-overlay.quiz-bg {
  background:
    linear-gradient(160deg, rgba(2, 62, 67, 0.38) 0%, rgba(1, 20, 22, 0.62) 100%),
    url('../img/login-bg.jpg') center / cover no-repeat;
}
/* Заголовок лежит прямо на фотографии, без карточки, поэтому подстраховываем
   тенью: иначе на светлом участке снимка белый текст пропадает. */
.quiz-overlay.quiz-bg .quiz-header .panel-title {
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}
.quiz-overlay.quiz-bg .quiz-header .muted-small {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

/* На телефоне широкий снимок обрезается по центру в узкую полоску. Сдвигаем
   кадр влево-вверх: там зелёный флаг и кроны, а не пустой ствол. */
@media (max-width: 700px) {
  .quiz-overlay.quiz-bg { background-position: 32% 30%, 32% 30%; }
}

/* Полноэкранный режим: кнопка рядом с переключателем темы, чуть выше */
.fullscreen-toggle-btn {
  position: fixed;
  bottom: 74px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 600;
  transition: transform 0.15s var(--ease);
}
.fullscreen-toggle-btn:hover { transform: scale(1.08); }
.fullscreen-toggle-btn svg { display: block; color: var(--text-main); }

.quiz-container {
  max-width: 680px;
  margin: 0 auto;
}

.quiz-header {
  text-align: center;
  margin-bottom: 24px;
}

.quiz-question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.quiz-question-text { font-weight: 600; margin-bottom: 4px; color: var(--text-main); }
.quiz-question-second { color: var(--text-secondary); margin-bottom: 12px; }

/* Вопрос-вырезка из PDF: дроби и формулы остаются такими же, как на бумаге.
   На тёмной теме скан белый, поэтому подкладываем белый фон и скругляем. */
.quiz-question-image {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #fff;
}

.quiz-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.quiz-option-label:hover { border-color: var(--green); }
.quiz-option-label.selected { border-color: var(--green); background: var(--green-light); }
.quiz-option-label input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }

/* Дробь столбиком: формулы из LaTeX в вопросах теста */
.mfrac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  margin: 0 2px;
  line-height: 1.15;
}
/* Черта дроби утолщается вместе с кеглем, как в книжном наборе, но не тоньше 1px */
.mfrac .mnum { border-bottom: max(1px, 0.06em) solid currentColor; padding: 0 3px; }
.mfrac .mden { padding: 0 3px; }

/* Система уравнений: большая фигурная скобка слева, строки одна под другой
   (mathCases в js/common.js). Скобка собрана из частей — крючок, вставка, мыс,
   вставка, крючок — и стоит поверх левого отступа: на высоту системы она не
   влияет, а тянется ровно по ней. */
.mcases {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0 2px;
  position: relative;
}
.mcases-braced { padding-left: 0.62em; min-height: 2.3em; }
.mbrace {
  position: absolute;
  left: 0; top: -0.05em; bottom: -0.05em;
  width: 0.5em;
  display: flex;
  flex-direction: column;
}
.mbrace-end { display: block; width: 0.5em; height: 0.6em; flex: none; }
.mbrace-mid { display: block; width: 0.5em; height: 1em; flex: none; }
.mbrace-ext { display: block; flex: 1 1 auto; min-height: 0; width: 0.09em; margin-left: 0.22em; background: currentColor; }
.mcases-rows {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  line-height: 1.3;
}
/* Круглые скобки вокруг дроби — по её высоте (mathStretchParens) */
.mdelim {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  position: relative;
  padding: 0 0.36em;
  margin: 0 1px;
}
/* Обычная строка, а не flex: во flex пропадали пробелы между частями — «(√x+√y)» */
.mdelim-body { display: block; white-space: nowrap; }
.mparen { position: absolute; top: 0; bottom: 0; width: 0.3em; height: 100%; }
.mparen-l { left: 0; }
.mparen-r { right: 0; }
.mcases-row { white-space: nowrap; }
/* Квадратный корень (mathSqrt): знак — по высоте подкоренного выражения,
   черта сверху — верхняя граница выражения; знак стоит поверх левого отступа */
.mroot {
  display: inline-block;
  position: relative;
  padding-left: 0.62em;
  margin: 0 1px;
  white-space: nowrap;
}
.mroot-sign { position: absolute; left: 0; top: 0; bottom: 0; width: 0.64em; height: 100%; }
.mroot-body {
  display: inline-block;
  border-top: max(1px, 0.06em) solid currentColor;
  padding: 0.14em 0.08em 0 0.06em;
  line-height: 1.15;
}

/* Отметить правильный ответ прямо в предпросмотре разбора */
.qb-pick-correct {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 4px 10px;
  margin: 0 6px 6px 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.qb-pick-correct:hover { border-color: var(--green); }
.qb-pick-correct.picked {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 700;
}

/* Вставка теста текстом */
.qb-paste-block {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--bg);
}
.qb-paste-sample {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}
.qb-paste-preview-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 6px;
}
.qb-paste-preview-item.has-problem { border-color: var(--red); }

/* Заголовок класса в результатах тестов */
.qb-class-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 6px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green);
  font-weight: 700;
  color: var(--text-main);
}
.qb-class-head:first-child { margin-top: 0; }

/* Вопрос-картинка в редакторе теста */
.qb-question-image { display: block; max-width: 100%; max-height: 360px; border: 1px solid var(--border); border-radius: 10px; margin: 4px 0 8px; }
.qb-image-letters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.qb-letter { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; cursor: pointer; }

/* ---- Блок тест → Результаты: поиск, фильтры, группы «тест · класс» ---- */
.qbr-filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(140px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.qbr-filters .field-input { margin: 0; min-width: 0; }
.qbr-filters select:disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 900px) { .qbr-filters { grid-template-columns: 1fr 1fr; } .qbr-filters input[type="search"] { grid-column: 1 / -1; } }
@media (max-width: 480px) { .qbr-filters { grid-template-columns: 1fr; } }
.qbr-group { border-bottom: 1px solid var(--border); }
.qbr-group:last-of-type { border-bottom: none; }
.qbr-group-head { cursor: pointer; list-style: none; margin: 0; padding: 12px 0 10px; }
.qbr-group-head::-webkit-details-marker { display: none; }
.qbr-group-title { font-weight: 600; }
.qbr-group-title::before { content: "▸"; display: inline-block; width: 1em; color: var(--text-secondary); transition: transform 0.15s var(--ease); }
.qbr-group[open] > .qbr-group-head .qbr-group-title::before { transform: rotate(90deg); }
.qbr-group-body { padding: 0 0 10px; }
.qbr-group-body .qbr-open-test { margin: 8px 0 0; }
.qbr-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.qbr-actions .btn-ghost-small, .qbr-actions .btn-cancel-tx { margin: 0; }
.qbr-row .tx-info { min-width: 0; }
.qbr-row a.tx-name { color: inherit; text-decoration: none; }
.qbr-row a.tx-name:hover { text-decoration: underline; }
.qbr-missing { font-size: 13px; line-height: 1.6; margin: 6px 0 4px; padding: 8px 10px; border-radius: 10px; background: var(--red-light); }
.qbr-missing b { color: var(--red); margin-right: 4px; }
.qbr-missing a { color: inherit; }
p.qbr-missing { background: none; padding: 4px 0; }
.tr-review-btn.tr-has-mistakes { color: var(--red); border-color: var(--red); }

/* ---- Разбор попытки теста (js/test-review.js) ---- */
.tr-ok { color: var(--green-dark); }
.tr-bad { color: var(--red); }
.tr-warn-text { color: var(--yellow-deep); }
.pay-dialog.tr-dialog { max-width: 720px; position: relative; }
.tr-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: var(--text-secondary); font-size: 28px; line-height: 1; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
.tr-close:hover { background: var(--green-wash); color: var(--text-main); }
.tr-head { padding-right: 40px; }
.tr-head .panel-title { margin: 0 0 2px; }
.tr-score { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.tr-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 10px; }
.tr-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tr-toggle-btn { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; padding: 7px 12px; cursor: pointer; }
.tr-toggle-btn.active { background: var(--green); color: #fff; }
/* Предметник: только ошибки — вместо переключателя подпись, у попытки без ошибок — отметка */
.tr-only-label { font-size: 14px; font-weight: 600; color: var(--red); }
.tr-no-mistakes { color: var(--green-dark); white-space: nowrap; }
/* Работа над ошибками закрыта учителям (откроет админ или завуч) и кнопка в списке тестов */
.tr-locked { white-space: nowrap; cursor: help; }
.qb-review-btn.is-open { color: var(--green-dark); border-color: var(--green-dark); }
.tr-show-btn { margin-left: auto; }
.tr-warn { background: var(--yellow-light); color: var(--yellow-deep); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 10px; }
.tr-item { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.tr-item.bad { border-left-color: var(--red); }
.tr-item.empty { border-left-color: var(--yellow); }
.tr-item.ok { border-left-color: var(--green); }
.tr-num { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.tr-q { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.tr-q2 { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; overflow-wrap: anywhere; }
.tr-opts { list-style: none; margin: 6px 0 0; padding: 0; }
.tr-opt { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px; border-radius: 8px; font-size: 14px; }
.tr-opt.correct { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.tr-opt.wrong { background: var(--red-light); color: var(--red); font-weight: 600; }
.tr-mark { flex: 0 0 1.1em; text-align: center; font-weight: 700; color: var(--text-secondary); }
.tr-opt.correct .tr-mark, .tr-opt.wrong .tr-mark { color: inherit; }
.tr-opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tr-tag { flex: 0 0 auto; font-size: 11px; font-weight: 600; opacity: 0.85; white-space: nowrap; }
.tr-vocab-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.tr-img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); margin: 4px 0 8px; }
.tr-passage { margin: 0 0 6px; }
.tr-passage summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); padding: 2px 0; }
.tr-passage .quiz-passage { margin: 6px 0 0; }
/* «Показать ученику»: во весь экран и крупно — экран поворачивают к ребёнку */
.tr-overlay.tr-big { padding: 0; }
.tr-overlay.tr-big .pay-dialog.tr-dialog { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; padding: 28px clamp(16px, 5vw, 72px); font-size: 19px; }
.tr-overlay.tr-big .tr-head .panel-title { font-size: 28px; }
.tr-overlay.tr-big .tr-head .muted-small { font-size: 16px; }
.tr-overlay.tr-big .tr-q { font-size: 24px; }
.tr-overlay.tr-big .tr-q2 { font-size: 18px; }
.tr-overlay.tr-big .tr-num { font-size: 15px; }
.tr-overlay.tr-big .tr-opt { font-size: 21px; padding: 10px 14px; }
.tr-overlay.tr-big .tr-tag { font-size: 14px; }
.tr-overlay.tr-big .tr-vocab-line { font-size: 21px; }
.tr-overlay.tr-big .tr-passage summary, .tr-overlay.tr-big .quiz-passage { font-size: 17px; }
.tr-overlay.tr-big .tr-item { padding: 16px 20px; margin-bottom: 14px; }
.tr-overlay.tr-big .tr-close { font-size: 36px; top: 12px; right: 16px; }
@media (max-width: 480px) { .tr-show-btn { margin-left: 0; } .tr-toggle { width: 100%; } .tr-toggle-btn { flex: 1; } }

/* ---- Тепловая карта прихода по дням месяца (Финансы) ---- */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.heatmap-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  padding-bottom: 4px;
}

.heatmap-cell {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  overflow: hidden;
}

.heatmap-cell-empty { border-color: transparent; }
.heatmap-cell-today { border-color: var(--green); border-width: 2px; }
.heatmap-day { font-weight: 600; color: var(--text-main); }
.heatmap-amount { color: var(--green-deep); font-size: 10px; margin-top: 2px; white-space: nowrap; }

/* ---- Поведение: раскрытая история отметок ученика внутри таблицы ---- */
.beh-detail-cell {
  background: var(--green-wash);
  text-align: left;
  padding: 4px 14px 8px;
}

.beh-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}
.beh-check-row input { margin: 0; flex-shrink: 0; }

@media (max-width: 640px) {
  /* На телефоне ячейки таблицы становятся flex-строками «подпись — значение»;
     для раскрытого блока это лишнее — он занимает всю ширину карточки. */
  .students-table td.beh-detail-cell {
    display: block;
    text-align: left;
    padding: 6px 0 2px;
  }
}

/* ============================================================
   Табель посещаемости
   ============================================================ */

/* ---- Перекличка: строка ученика с четырьмя состояниями ---- */
.attd-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.attd-row:last-child { border-bottom: none; }
/* Причина опоздания / пропуска — отдельной строкой под именем и кнопками.
   flex-wrap только ради неё: у имени ниже нулевая основа, поэтому кнопки
   с именем по-прежнему в одной строке. */
.attd-row { flex-wrap: wrap; }
.attd-reason {
  flex: 1 1 100%;
  margin-left: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
}
.attd-reason[hidden] { display: none; }

.attd-num {
  width: 22px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}
/* min-width: 0 обязателен — иначе длинное имя не даёт строке сжаться
   и кнопки уезжают за панель. */
.attd-name {
  flex: 1 1 0;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attd-seg {
  display: flex;
  gap: 4px;
  flex: 0 1 340px;
  min-width: 0;
}
.attd-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease);
}
.attd-btn:hover { border-color: var(--green); }
.attd-btn.is-on { font-weight: 600; }
.attd-present.is-on { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }
.attd-late.is-on { background: var(--yellow-light); border-color: var(--yellow); color: var(--yellow); }
.attd-excused.is-on { background: var(--border); border-color: var(--text-secondary); color: var(--text-main); }
.attd-unexcused.is-on { background: var(--red-light); border-color: var(--red); color: var(--red); }

/* ---- Сетка табеля: широкая таблица со скроллом вбок ---- */
.attd-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.attd-grid {
  border-collapse: collapse;
  font-size: 12px;
  background: var(--surface);
}
.attd-grid th, .attd-grid td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0;
}

/* Номер и имя остаются на месте при прокрутке вбок — иначе в середине
   месяца непонятно, чья это строка. */
.attd-grid .attd-num-col {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 34px;
  min-width: 34px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11px;
}
.attd-grid .attd-name-col {
  position: sticky;
  left: 34px;
  z-index: 2;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  background: var(--surface);
  text-align: left;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attd-grid thead .attd-num-col, .attd-grid thead .attd-name-col { z-index: 3; background: var(--green-wash); }

.attd-grid .attd-day {
  width: 26px;
  min-width: 26px;
  padding: 3px 0;
  cursor: pointer;
  background: var(--green-wash);
  line-height: 1.1;
}
.attd-grid .attd-day:hover { background: var(--green-light); }
.attd-grid .attd-day.is-active { outline: 2px solid var(--green); outline-offset: -2px; }
.attd-day-num { display: block; font-weight: 600; }
.attd-day-wd { display: block; font-size: 9px; color: var(--text-secondary); font-weight: 400; }

.attd-cell { height: 26px; font-weight: 600; font-size: 11px; }
.attd-c-late { background: var(--yellow-light); color: var(--yellow); }
.attd-c-excused { background: var(--border); color: var(--text-main); }
.attd-c-unexcused { background: var(--red-light); color: var(--red); }
.attd-c-present { background: var(--green-light); color: var(--green-dark); }
.attd-grid .is-off { background: var(--border); }
.attd-grid .is-empty { background: repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border) 3px, var(--border) 4px); }

.attd-grid .attd-total-col {
  width: 48px;
  min-width: 48px;
  font-size: 11px;
  background: var(--green-wash);
}

.attd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.attd-legend-item { display: flex; align-items: center; gap: 5px; }
.attd-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

@media (max-width: 640px) {
  /* На телефоне имя и кнопки не помещаются в одну строку: имя сверху,
     четыре состояния под ним во всю ширину. */
  .attd-row { flex-wrap: wrap; gap: 6px; }
  .attd-name { flex: 1 1 auto; }
  .attd-seg { flex: 1 1 100%; }
  .attd-reason { margin-left: 0; }
  .attd-btn { font-size: 11px; padding: 7px 2px; }
  .attd-grid .attd-name-col { width: 120px; min-width: 120px; max-width: 120px; }
}

/* Заморожен — ученик заведён заранее и ещё не учится. Пунктир отличает
   его от сплошного серого «Исключён»: это временное состояние. */
.status-frozen {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px dashed var(--text-secondary);
}

/* ---- Экзамены по книгам: таблица баллов «класс × месяц» ---- */
.bex-detail-cell {
  background: var(--green-wash);
  text-align: left;
  padding: 4px 14px 10px;
}

.bex-scroll { overflow-x: auto; }

.bex-matrix {
  border-collapse: collapse;
  font-size: 12px;
  background: var(--surface);
}
.bex-matrix th, .bex-matrix td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0;
}
.bex-matrix th {
  background: var(--green-light);
  color: var(--green-deep);
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 8px;
}
.bex-matrix input {
  width: 66px;
  border: 0;
  background: transparent;
  text-align: center;
  font: inherit;
  color: var(--text-main);
  padding: 5px 2px;
}
.bex-matrix input:focus {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}
.bex-matrix input::placeholder { color: var(--text-secondary); opacity: 0.6; }

@media (max-width: 640px) {
  /* Внутри карточки строки таблица должна занимать всю ширину, а не колонку */
  .students-table td.bex-detail-cell {
    display: block;
    text-align: left;
    padding: 6px 0 4px;
  }
}

@media (max-width: 640px) {
  /* Мобильные правила выше превращают строки .students-table в карточки.
     Они написаны без учёта вложенных таблиц и цепляют потомков — таблица
     баллов внутри раскрытой строки схлопывалась. Возвращаем ей обычный вид,
     прокручиваться вбок она умеет сама. */
  .students-table .bex-matrix { display: table; width: auto; }
  .students-table .bex-matrix thead { display: table-header-group; }
  .students-table .bex-matrix tbody { display: table-row-group; }
  .students-table .bex-matrix tr {
    display: table-row;
    border: 0;
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
  }
  /* Селектор повторяет форму правила выше (.students-table td:not([data-label])
     :not([colspan]) { display: none }) с добавлением своего класса — иначе то
     правило специфичнее и ячейки таблицы баллов просто исчезают. */
  .students-table .bex-matrix th,
  .students-table .bex-matrix td,
  .students-table .bex-matrix td:not([data-label]):not([colspan]),
  .students-table .bex-matrix td:empty {
    display: table-cell;
    width: auto;
    text-align: center;
    border: 1px solid var(--border);
    padding: 0;
  }
  .students-table .bex-matrix th { padding: 5px 8px; }
  .students-table .bex-matrix td::before { content: none; }
}

/* ==================================================
   Восстановление из резервной копии (дашборд админа)
   ================================================== */
.bk-mode-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}
.bk-mode-row input { margin-top: 3px; flex: none; }
.bk-mode-row b { color: var(--text-main); }

.bk-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.bk-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--green-wash);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
.bk-col-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--text-main);
}
.bk-col-row + .bk-col-row { border-top: 1px solid var(--border); }
.bk-col-off { opacity: 0.68; cursor: default; }
.bk-col-name { flex: 1 1 auto; min-width: 0; }
.bk-col-count {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.bk-col-note {
  flex: none;
  font-size: 12px;
  color: var(--text-secondary);
}
.bk-warn { color: var(--yellow-deep); }

.bk-report {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.bk-report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  color: var(--text-main);
}
.bk-report-row + .bk-report-row { border-top: 1px solid var(--border); }
.bk-report-failed { background: var(--red-light); }

@media (max-width: 700px) {
  /* На телефоне строка не переносится: название само сжимается и при нужде
     ложится в две строки, а число и пометка остаются справа. Перенос всей
     строки уводил галку на отдельную строку и растил ряд до трёх. */
  .bk-col-row { padding: 7px 10px; gap: 8px; }
  .bk-col-note { max-width: 46%; text-align: right; }
}

/* Касса на дашборде: сегодня и остаток по способам оплаты */
.cash-panel { margin-bottom: 18px; }
.cash-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.cash-head .btn-ghost-small { margin: 0 0 0 auto; }
.cash-row-label { margin: 16px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-secondary); }
.cash-head + .cash-row-label { margin-top: 0; }
.cash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cash-grid > .loading-text,
.cash-grid > .cash-error,
.cash-grid-note { grid-column: 1 / -1; margin: 0; }
.cash-card { min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-top: 3px solid var(--cash-accent, var(--green)); border-radius: 12px; background: var(--surface); }
.cash-card.m0 { --cash-accent: #16a34a; }
.cash-card.m1 { --cash-accent: #2563eb; }
.cash-card.m2 { --cash-accent: #7c3aed; }
.cash-card.total { border: 2px solid var(--green-deep); background: var(--green-wash); }
.cash-card-label { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cash-ico { font-size: 15px; line-height: 1; }
.cash-card-value { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.25; color: var(--text-main); font-variant-numeric: tabular-nums; }
.cash-card-value.neg,
.cash-card-value.neg .cash-cur { color: var(--red); }
.cash-num { white-space: nowrap; }
.cash-cur { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cash-card-sub { margin: 4px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.cash-warn { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--red-light); color: var(--red); font-size: 13px; line-height: 1.45; }
.cash-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--red); }
.cash-error .btn-ghost-small { margin: 0; }
.cash-panel .dash-came-link { display: inline-block; margin-top: 12px; }
@media (max-width: 860px) {
  .cash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cash-card-value { font-size: 18px; }
}

/* ---- Проценты классов → «Динамика и сравнение» (js/pct-dynamics.js) ----
   Цвета линий — та же проверенная палитра, что у «По категориям»; серый —
   среднее по школе / по классу. Стрелки роста и падения идут вместе с
   числом: цвет — не единственный признак. */
.pdyn {
  --pdyn-1: #2a78d6; --pdyn-2: #eb6834; --pdyn-3: #1baf7a; --pdyn-4: #eda100;
  --pdyn-5: #e87ba4; --pdyn-6: #008300; --pdyn-7: #4a3aa7; --pdyn-avg: #8a9891;
}
body.dark-theme .pdyn {
  --pdyn-1: #3987e5; --pdyn-2: #d95926; --pdyn-3: #199e70; --pdyn-4: #c98500;
  --pdyn-5: #d55181; --pdyn-6: #008300; --pdyn-7: #9085e9; --pdyn-avg: #7d8c85;
}
.pdyn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.pdyn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pdyn-chip { padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: inherit; font-size: 13px; color: var(--text-main); cursor: pointer; }
.pdyn-chip:hover { border-color: var(--green); color: var(--green-deep); }
.pdyn-chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.pdyn-chip-clear { color: var(--text-secondary); border-style: dashed; }
.pdyn-chart { position: relative; height: 340px; }
.pdyn-table td, .pdyn-table th { white-space: nowrap; }
.pdyn-table th:first-child, .pdyn-table td:first-child { text-align: left; }
.pdyn-first { display: inline-flex; align-items: center; gap: 8px; }
.pdyn-check { width: 16px; height: 16px; margin: 0; accent-color: var(--green); cursor: pointer; }
.pdyn-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; }
.pdyn-open { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-main); text-align: left; cursor: pointer; white-space: normal; }
.pdyn-open:hover { color: var(--green-deep); text-decoration: underline; }
.pdyn-cell { white-space: nowrap; }
.pdyn-delta { margin-left: 5px; font-size: 11px; font-weight: 600; }
.pdyn-delta.up, .pdyn-change.up, .pdyn-tile-value.up { color: var(--green-dark); }
.pdyn-delta.down, .pdyn-change.down, .pdyn-tile-value.down { color: var(--red); }
.pdyn-change { font-weight: 700; }
.pdyn-change.same { color: var(--text-secondary); }
.pdyn-row-avg td { background: var(--green-wash); border-top: 2px solid var(--border); }
.pdyn-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 4px 0 14px; }
.pdyn-tile { padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.pdyn-tile-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.pdyn-tile-value { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; color: var(--text-main); font-variant-numeric: tabular-nums; }
/* Показ на проекторе: блок на весь экран, график крупнее */
.pdyn-block:fullscreen { padding: 28px 36px; overflow: auto; background: var(--surface); border-radius: 0; }
.pdyn-block:fullscreen .pdyn-chart { height: 62vh; }
.pdyn-block:fullscreen .panel-title { font-size: 26px; }
.pdyn-block:-webkit-full-screen { padding: 28px 36px; overflow: auto; background: var(--surface); border-radius: 0; }
.pdyn-block:-webkit-full-screen .pdyn-chart { height: 62vh; }
@media (max-width: 640px) {
  .pdyn-chart { height: 280px; }
  .pdyn-actions { margin-left: 0; }
}

/* ---- «По категориям» с выбором способа оплаты (js/cat-breakdown.js) ----
   Главная админа и «Финансы» → «Дашборд». Семь цветов категорий — в этом
   порядке соседние различимы и при дальтонизме (проверено на светлой и тёмной
   подложке); остальные категории — серым. Текст цветом категории не красим:
   её цвет несёт точка и полоска рядом. */
.cb {
  container: cb / inline-size;   /* узкая колонка в «Финансах» и телефон — по ширине самого блока */
  --cb-1: #2a78d6; --cb-2: #eb6834; --cb-3: #1baf7a; --cb-4: #eda100;
  --cb-5: #e87ba4; --cb-6: #008300; --cb-7: #4a3aa7; --cb-other: #a3b0aa;
}
body.dark-theme .cb {
  --cb-1: #3987e5; --cb-2: #d95926; --cb-3: #199e70; --cb-4: #c98500;
  --cb-5: #d55181; --cb-6: #008300; --cb-7: #9085e9; --cb-other: #5c6b64;
}
.cb button { font: inherit; color: var(--text-main); cursor: pointer; text-align: left; }
.cb button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.cb-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cb-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cb-side:hover { border-color: var(--green); }
.cb-side.active { padding: 11px 13px; border: 2px solid var(--green-deep); background: var(--green-wash); }
.cb-side-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cb-side-label::before { content: "↓"; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); font-size: 12px; font-weight: 800; }
.cb-side-expense .cb-side-label::before { content: "↑"; background: var(--red-light); color: var(--red); }
.cb-side-sum { font-size: 21px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.cb-side-count { font-size: 12px; color: var(--text-secondary); }
.cb-row-label { margin: 16px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-secondary); }
.cb-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.cb-method { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cb-method:hover { border-color: var(--green); }
.cb-method.active { border-color: var(--green); background: var(--green-light); box-shadow: inset 0 0 0 1px var(--green); }
.cb-method-name { font-size: 13px; font-weight: 600; }
.cb-method-sum { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cb-method-share { font-size: 11.5px; color: var(--text-secondary); }
.cb-method-empty .cb-method-sum { font-weight: 600; color: var(--text-secondary); }
.cb-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 28px; margin-top: 18px; }
.cb-donut { position: relative; flex: 0 0 220px; width: 220px; min-width: 0; max-width: 100%; height: 220px; margin: 0 auto; }   /* min-width: иначе холст растягивает блок до своих 300px */
.cb-donut-empty { display: none; }
.cb-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 44px; text-align: center; pointer-events: none; }
.cb-total { font-size: 16px; font-weight: 800; line-height: 1.25; color: var(--text-main); font-variant-numeric: tabular-nums; }
.cb-count { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.cb-list { flex: 1 1 300px; min-width: 0; }
.cb-list > .loading-text { margin: 0; }
.cb-item { padding: 9px 0; border-bottom: 1px solid var(--border); }
.cb-item:first-child { padding-top: 0; }
.cb-item:last-child { border-bottom: none; padding-bottom: 0; }
.cb-rowbtn { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 40px; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none; }
.cb-dot { width: 10px; height: 10px; border-radius: 50%; }
.cb-name { font-weight: 600; overflow-wrap: break-word; }   /* длинное название переносится по словам, а не обрезается */
.cb-name::after { content: " ▸"; color: var(--text-secondary); font-weight: 400; }
.cb-item.open .cb-name::after { content: " ▾"; }
.cb-rowbtn:hover .cb-name { color: var(--green-deep); }
.cb-val { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-pct { text-align: right; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cb-bar { height: 6px; margin: 7px 0 5px 18px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.cb-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.cb-split { margin: 0 0 0 18px; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.cb-split b { font-weight: 600; color: var(--text-main); white-space: nowrap; }
.cb-ops { margin: 8px 0 2px 18px; padding: 4px 10px; border-radius: 10px; background: var(--bg); }
.cb-op { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.cb-op:last-child { border-bottom: none; }
.cb-op-date { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cb-op-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-op-method { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.cb-op-sum { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-op-more { margin: 6px 0 4px; font-size: 12px; color: var(--text-secondary); }
.cb .cb-more { display: block; width: 100%; margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; background: none; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-align: center; }
.cb .cb-more:hover { border-color: var(--green); color: var(--green-deep); }
.cb-what { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.dash-cat-panel { margin-bottom: 18px; }
.dash-cat-panel .tab-row { margin: 0 0 0 auto; padding: 3px; }
.dash-cat-panel .tab-btn { padding: 6px 12px; font-size: 13px; }
@container cb (max-width: 560px) {
  .cb-side { padding: 10px 12px; }
  .cb-side.active { padding: 9px 11px; }
  .cb-side-sum { font-size: 16px; }
  .cb-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cb-method-sum { font-size: 14px; }
  .cb-op { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .cb-op-method { display: none; }
}
@container cb (max-width: 340px) {
  .cb-side-sum { font-size: 14px; }
  .cb-rowbtn { grid-template-columns: 10px minmax(0, 1fr) auto 30px; gap: 6px; }
  .cb-name, .cb-val { font-size: 14px; }
  .cb-pct { font-size: 12px; }
}
/* Совсем узко (узкое окно «Финансов», телефон 320px): кнопки в один столбец,
   название категории — отдельной строкой над суммой, чтобы числа не рвались
   посередине, а слова — по буквам */
@container cb (max-width: 300px) {
  .cb-sides, .cb-methods { grid-template-columns: 1fr; }
  .cb-side-sum { font-size: 16px; }
  .cb-name { grid-column: 2 / -1; }
  .cb-val { grid-column: 3; }
  .cb-pct { grid-column: 4; }
}
/* «Финансы» → «Дашборд»: в две колонки блоку «По категориям» тесно уже при
   окне уже 1100px — колонки ставим друг под другом раньше */
@media (max-width: 1100px) {
  #dashSection .dashboard-grid { grid-template-columns: 1fr; gap: 0; }
}
.dash-cat-busy { opacity: 0.45; pointer-events: none; }
/* «Финансы»: панель «Год / Месяц» на вкладках без неё. Не display:none —
   поля должны оставаться «на странице» для js/page-state.js */
.fin-month-off { visibility: hidden; height: 0; min-height: 0; overflow: hidden; padding: 0 !important; margin: 0 !important; border: 0 !important; }

/* ---- Сворачиваемая панель: редкие и опасные действия спрятаны за заголовком ----
   Восстановление из копии и «Опасная зона» на видном месте только отвлекали и
   пугали; открывать их нужно раз в полгода — пусть раскрываются щелчком. */
.panel-details > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  user-select: none;
}
.panel-details > summary::-webkit-details-marker { display: none; }
.panel-details > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
  opacity: 0.6;
}
.panel-details[open] > summary::before { transform: rotate(45deg); }
.panel-details[open] > summary { margin-bottom: 14px; }
.panel-details > summary:hover { color: var(--green-dark); }
.panel-danger { border-color: var(--red); }
.panel-danger > summary { color: var(--red); }

/* ---- Широкая таблица не должна растягивать страницу ----
   На ноутбуке с открытым меню таблицы учеников и должников вылезали за край
   экрана, и вся страница получала горизонтальную прокрутку. Прокручивается
   теперь сама панель с таблицей; там, где :has не поддерживается, всё как раньше. */
.panel:has(> .students-table):not(:has(.autocomplete-list)) {
  /* Панель с выпадающим поиском не прокручиваем: overflow обрезал бы список
     подсказок — так и случилось в English Unit. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- «Забыли пароль?» под формой входа ---- */
.login-forgot {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.login-forgot:hover { color: var(--green-dark); }

/* ---- Кнопка «напечатать чек» у имени в списке оплат кассы ---- */
.btn-print-tx {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn-print-tx:hover { background: var(--green-light); border-color: var(--green); }

/* ---- Раздел «Vocabulary» на странице теста: слово по-узбекски и по-русски ---- */
.vocab-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.vocab-row:last-of-type { border-bottom: none; }
.vocab-word { font-size: 18px; font-weight: 600; color: var(--green-deep); }
.vocab-n { color: var(--text-secondary); font-weight: 600; }
.vocab-uz { color: var(--green-deep); }
.vocab-ru { color: var(--text-main); }
.vocab-sep { color: var(--text-secondary); font-weight: 400; }
.vocab-row .field-input { margin: 0; }
@media (max-width: 520px) {
  .vocab-row { grid-template-columns: 1fr; gap: 6px; }
}

/* Итог: весёлая или грустная анимация вместо гифки — без внешних файлов */
.vocab-mood { font-size: 72px; line-height: 1; margin: 6px 0 10px; display: inline-block; }
.vocab-mood.happy { animation: vocabBounce 0.9s var(--ease) infinite alternate; }
.vocab-mood.sad { animation: vocabShake 1.6s var(--ease) infinite; }
@keyframes vocabBounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-14px) scale(1.12); }
}
@keyframes vocabShake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}
.vocab-confetti { position: relative; overflow: hidden; }
.vocab-confetti i {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px;
  animation: vocabFall 2.4s linear infinite;
}
@keyframes vocabFall {
  to { transform: translateY(380px) rotate(360deg); opacity: 0; }
}
.vocab-review { text-align: left; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.vocab-review .ok { color: var(--green-dark); }
.vocab-review .bad { color: var(--red); }
.vocab-review .typo { color: var(--yellow-deep); }
.vocab-review-line { font-size: 15px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.vocab-review-line:last-child { border-bottom: none; }
.vocab-review-ans { display: block; font-size: 14px; margin-top: 2px; }

/* «Блок тест»: какие слова идут в тест — с №, по №, сколько */
.vocab-set-row { margin-bottom: 10px; }
.vocab-set-fields { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 8px; align-items: center; }
.vocab-set-fields .field-input { margin: 0; min-width: 0; }
.vocab-set-fields label:nth-of-type(3) { grid-column: 1 / 3; }
.vocab-set-fields input:nth-of-type(3) { grid-column: 3 / 5; }

/* Реакция на слово и гифка итога */
.vocab-answer { display: flex; align-items: center; gap: 8px; }
.vocab-answer .field-input { flex: 1 1 auto; }
.vocab-react { font-size: 22px; line-height: 1; animation: vocabPop 0.35s var(--ease) both; }
@keyframes vocabPop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.vocab-input[readonly] { background: var(--green-wash); color: var(--text-secondary); }
.vocab-gif { display: block; max-width: 320px; max-height: 240px; margin: 0 auto 8px; border-radius: 12px; }

/* Гифка за 95%+: на весь экран, по центру */
.win-gif-screen { text-align: center; padding-top: 4vh; }
.win-gif-percent {
  font-family: var(--font-display);
  font-size: 64px; font-weight: 700; line-height: 1; margin: 0 0 14px;
  color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}
.win-gif {
  display: block; margin: 0 auto;
  max-width: min(92vw, 640px); max-height: 62vh;
  border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: winGifIn 0.5s var(--ease) both;
}
@keyframes winGifIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Тест: полоса сверху — название, крупный таймер, «отвечено», номера ---- */
.quiz-bar {
  position: sticky; top: -24px; z-index: 5;   /* у окна теста отступ сверху 24px — прилипаем к самому краю */
  max-width: 760px; margin: -24px auto 16px; padding: 10px 14px 8px;
  background: var(--surface); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-md);
}
.quiz-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-bar-who { display: flex; flex-direction: column; min-width: 0; }
.quiz-bar-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-bar-name { font-size: 12px; color: var(--text-secondary); }
.quiz-bar-timer {
  flex: 0 0 auto; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 12px;
  background: var(--green-light); color: var(--green-dark);
}
.quiz-bar.warn5 .quiz-bar-timer { background: var(--yellow-light); color: var(--yellow-deep); }
.quiz-bar.warn1 .quiz-bar-timer { background: var(--red-light); color: var(--red); animation: quizTimerPulse 1s infinite; }
@keyframes quizTimerPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.quiz-bar-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; font-size: 13px; font-weight: 600; }
.quiz-bar-meter { flex: 1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.quiz-bar-meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.25s var(--ease); }
.quiz-nums { display: flex; flex-wrap: wrap; gap: 4px; max-height: 76px; overflow-y: auto; }
.quiz-num {
  min-width: 30px; height: 28px; padding: 0 6px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--red); background: var(--red-light); color: var(--red);
  font: inherit; font-size: 12px; font-weight: 700;
}
.quiz-num.done { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }
.quiz-flash { display: none; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--yellow-light); color: var(--yellow-deep); font-weight: 700; text-align: center; }
.quiz-flash.show { display: block; animation: quizFlash 6s var(--ease) forwards; }
@keyframes quizFlash { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
.quiz-overlay .quiz-question-card { scroll-margin-top: calc(var(--quiz-bar-h, 120px) + 10px); }
.quiz-passage-card { border-left: 4px solid var(--green); }
.quiz-passage-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.quiz-passage-card .quiz-passage { margin: 0; background: transparent; border: 0; padding: 0; font-size: 15px; }
@media (max-width: 600px) {
  .quiz-bar-timer { font-size: 24px; padding: 5px 9px; }
  .quiz-nums { flex-wrap: nowrap; overflow-x: auto; max-height: none; padding-bottom: 2px; }
}
/* Во время теста кнопки полного экрана нет: её нажатие считалось нарушением */
body.quiz-running .fullscreen-toggle-btn { display: none !important; }

/* Итог теста: «12 из 20» и номера ошибок */
.quiz-score-line { font-size: 20px; font-weight: 700; margin: -6px 0 14px; color: var(--text-main); }
.quiz-mistakes { margin: 0 0 4px; font-weight: 600; font-size: 15px; }

/* «Это ты?» перед началом теста */
.anticheat-modal.st-who-modal { background: rgba(2, 62, 67, 0.72); }
.st-who-q { margin: 0 0 6px; font-size: 18px; color: var(--text-secondary); }
.st-who-name { margin: 0 0 6px; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--text-main); overflow-wrap: anywhere; }
.st-who-meta { margin: 0 0 20px; font-size: 16px; color: var(--text-secondary); }
.st-who-actions, .anticheat-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.st-who-actions .btn-primary, .anticheat-actions .btn-primary { width: auto; padding: 12px 22px; }
.st-who-actions .btn-small, .anticheat-actions .btn-small { background: var(--text-secondary); }

/* Предупреждение антисписывания — поверх теста, на весь экран */
.anticheat-modal {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(120, 20, 10, 0.86);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.anticheat-card {
  background: var(--surface); color: var(--text-main);
  border-radius: var(--radius-lg); padding: 28px 26px; max-width: 460px; width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.25s var(--ease) both;
}
.anticheat-icon { font-size: 54px; line-height: 1; margin-bottom: 8px; }
.anticheat-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0 0 8px; color: var(--red); }
.anticheat-reason { font-size: 16px; margin: 0 0 6px; }
.anticheat-left { font-size: 14px; color: var(--text-secondary); margin: 0 0 18px; }

/* ---- Страница «QR-коды»: карточки в сетке ---- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.qr-grid .panel { margin-bottom: 0; text-align: center; }
.qr-card .field-input { width: 100%; }
.qr-card .filter-row { justify-content: center; }

/* ---- Полоса «нет связи» (js/common.js netRenderBanner) ---- */
.net-offline-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 10000; background: var(--red); color: #fff; text-align: center; font-weight: 600; padding: 8px 12px; font-size: 14px; }

/* ---- «Вышла новая версия сайта» (js/common.js niholVerBanner): пилюля сверху, под полосой «нет связи» ---- */
.ver-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9999; width: max-content; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--green-deep); color: #fff; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); }
.ver-banner small { display: block; font-size: 12.5px; font-weight: 500; opacity: .85; margin-top: 2px; }
.ver-banner button { flex: none; padding: 8px 14px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
body.dark-theme .ver-banner { color: #06301F; }
body.dark-theme .ver-banner button { color: #06301F; }
@media print { .ver-banner { display: none !important; } }

/* Касса: при закрытом дне кнопки проведения приглушены (сами они ещё и отказывают через cashDayGuard) */
.is-day-closed { opacity: 0.45; }

/* ---- Чат: непрочитанные, поиск, закреплённые, инструменты сообщения ---- */
/* Цвета только из переменных темы: жёстко заданный белый фон оставался белым
   и в тёмной теме, а текст на нём брался от body (почти белый) — карточку
   «Новые сообщения» на всех страницах было не прочитать. */
.chat-unread-banner { position: fixed; right: 16px; bottom: 16px; z-index: 9000; width: 300px; max-width: calc(100vw - 32px); background: var(--surface); color: var(--text-main); border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.18); padding: 14px 16px; }
.chat-unread-title { font-weight: 700; margin-bottom: 4px; }
.chat-unread-names { color: var(--text-secondary); font-size: 13px; margin-bottom: 10px; }
.chat-unread-open { display: block; text-align: center; text-decoration: none; padding: 9px 12px; }
.chat-unread-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--text-secondary); }
/* Кнопки под списком чатов */
.chat-side-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--border); }
.chat-side-link { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 13px; text-align: left; padding: 8px 8px; border-radius: 8px; cursor: pointer; }
.chat-side-link:hover { background: var(--green-wash); color: var(--text-main); }
.chat-side-count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--border); color: var(--text-main); font-size: 11px; font-weight: 700; text-align: center; }
.chat-side-count:empty { display: none; }
.chat-side-count.alert { background: var(--red); color: #fff; }
/* Окна жалобы, списка заблокированных и жалоб */
.chat-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.4); }
.chat-modal[hidden] { display: none; }
.chat-modal-box { width: 100%; max-width: 460px; margin: 0; max-height: calc(100dvh - 32px); overflow-y: auto; }
.chat-modal-box.wide { max-width: 680px; }
.chat-modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.chat-modal-actions > button { margin: 0; }
.chat-report-quote { background: var(--green-wash); border-left: 3px solid var(--green); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-main); white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow-y: auto; }
.chat-report-label { font-weight: 600; margin: 12px 0 6px; font-size: 14px; }
.chat-report-reasons { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.chat-report-reasons label, .chat-report-block { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.chat-report-reasons input, .chat-report-block input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.chat-report-note-input { width: 100%; resize: vertical; }
.chat-report-hint { color: var(--text-secondary); font-size: 12.5px; margin: 6px 0 0; }
.chat-blocked-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.chat-blocked-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-blocked-row .btn-ghost-small { margin: 0; }
#chatReportsList, #chatBlockedList { margin-top: 10px; }
.chat-report-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.chat-report-card.gone { opacity: 0.75; }
.chat-report-where { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.chat-report-n { color: var(--red); font-weight: 600; white-space: nowrap; }
.chat-report-msg { background: var(--green-wash); border-radius: 10px; padding: 8px 12px; }
.chat-report-author { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.chat-report-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.chat-report-note { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; word-break: break-word; }
.chat-report-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.chat-report-list li { margin: 2px 0; word-break: break-word; }
.chat-report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-report-actions .btn-ghost-small, .chat-report-actions .btn-small { margin: 0; }
.chat-report-del { background: var(--red); }
/* Учёт 4-х классов на телефоне: кнопка на всю ширину, статус под ней */
@media (max-width: 768px) {
  #hcSaveBtn { width: 100%; }
}

/* ---- Сайт как приложение: кнопки обновления и «потяните вниз» ---- */
.sidebar-reload { margin-top: 16px; width: 100%; }
.sidebar-reload + .sidebar-logout { margin-top: 8px; }
.btn-reload-float { position: fixed; bottom: 20px; left: 20px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); font-size: 22px; line-height: 1; cursor: pointer; z-index: 100; color: var(--green-deep); }
.btn-reload-float:active { transform: rotate(180deg); }
.pull-refresh-hint { position: fixed; top: 0; left: 0; right: 0; padding: 10px; text-align: center; font-size: 13px; background: var(--green); color: #fff; transform: translateY(-100%); transition: transform .15s; z-index: 9500; }
.pull-refresh-hint.show { transform: translateY(0); }

/* Свой жест «потянуть вниз» (js/common.js) вместо встроенного в Chrome */
body { overscroll-behavior-y: contain; }

/* ---- Телефон: поля дат не вылезают за карточку, тема — в меню ---- */
.form-row > div { min-width: 0; }
.field-input[type="date"], .field-input[type="month"], .field-input[type="time"] {
  min-width: 0; max-width: 100%; box-sizing: border-box; -webkit-appearance: none; appearance: none; display: block;
}
.sidebar-theme { margin-top: 8px; width: 100%; }
@media (max-width: 768px) {
  body.has-sidebar .theme-toggle-btn { display: none; }
}
@media (min-width: 769px) {
  .sidebar-theme { display: none; }
}

/* Текст для чтения над вопросом теста (импорт из Word) */
.quiz-passage { background: var(--green-wash); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; font-size: 14px; line-height: 1.5; }

/* Разбор ошибок на экране результата теста */
.quiz-review { text-align: left; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.quiz-review .ok { color: var(--green-dark); }
.quiz-review .bad { color: var(--red); }
.quiz-review-item { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.quiz-review-q { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
/* Коды доступа и код учителя — не пароли: поле текстовое с маскировкой, чтобы
   браузер не предлагал «сохранить пароль» (всплывашка уводила фокус из теста) */
.code-mask { -webkit-text-security: disc; }

/* ---- Напоминания (reminders.html) ---- */
.rem-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.rem-row-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.rem-row-time { flex: 0 0 auto; font-weight: 700; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.rem-row-text { overflow-wrap: anywhere; }
.rem-overdue .rem-row-time { color: var(--red); }
.rem-overdue .rem-row-text { color: var(--red); }
.rem-done { opacity: 0.55; }
.rem-done .rem-row-text { text-decoration: line-through; }
.rem-row-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.rem-icon-btn { border: 0; background: rgba(0,0,0,0.05); border-radius: 6px; cursor: pointer; font-size: 13px; padding: 4px 8px; }
.rem-section-title { font-weight: 700; font-size: 13px; color: var(--text-secondary); margin: 14px 0 4px; }
.rem-overdue-title { color: var(--red); }
.rem-done-details { margin-top: 10px; }
.rem-done-details summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); padding: 6px 0; }
#remMicBtn.btn-listening { background: var(--red); animation: rem-pulse 1s infinite; }
@keyframes rem-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ---- Напоминания: язык озвучки (отдельно от языка сайта) ---- */
.rem-voice-lang-btn { border: none; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px; cursor: pointer; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.rem-voice-lang-btn.active { background: var(--green); color: #fff; }

/* ---- Касса: комментарий кассира к операции (js/cashier.js) ---- */
.tx-comment { font-size: 12px; color: var(--text-secondary); font-style: italic; overflow-wrap: anywhere; }

/* ---- Фото в карточке ученика и сотрудника (js/photo-card.js) ---- */
/* Шапка карточки: фото слева, имя и класс справа. На телефоне — столбиком,
   иначе имя длиной в три слова сжимается в узкую колонку. */
.card-head { display: flex; gap: 16px; align-items: flex-start; }
.card-head-text { min-width: 0; flex: 1; }
.card-photo { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.card-photo-frame {
  width: 104px; height: 104px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--green-wash);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.card-photo-empty { font-size: 12px; color: var(--text-secondary); text-align: center; padding: 0 6px; }
.card-photo-actions { display: flex; flex-direction: column; gap: 6px; width: 104px; }
.card-photo-actions .btn-small { width: 100%; }

/* Маленькое фото в строке списка (common.js photoThumb) */
.row-photo {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  object-fit: cover; vertical-align: middle;
  /* картинку ставит js/common.js photoThumbFill фоном этого же span */
  background-size: cover; background-position: center;
  /* background-color, а не сокращение background: оно сбросило бы
     background-size и position выше, и фото легло бы обрезанным углом */
  background-color: var(--green-wash); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.row-photo-empty { line-height: 30px; text-align: center; }

@media (max-width: 700px) {
  .card-head { flex-direction: column; align-items: center; text-align: center; }
  .card-head-text { text-align: center; }
}

/* Конструктор тестов: вкладки предметов (готовые тесты и список тестов) */
.qb-subject-tabs { flex-wrap: wrap; width: auto; max-width: 100%; margin-bottom: 10px; }
.qb-subject-tabs .tab-btn { padding: 7px 14px; white-space: nowrap; }
.qb-tab-count { font-size: 12px; opacity: 0.7; margin-left: 2px; }
.qb-list-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; margin-bottom: 6px; }
.qb-list-filters .field-input { max-width: 280px; margin: 0; }

/* Готовые тесты: строка «серия — варианты» вместо стены больших кнопок */
.qb-ready-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.qb-ready-row:last-child { border-bottom: none; }
.qb-ready-name { flex: 1 1 260px; min-width: 0; font-size: 14px; font-weight: 500; color: var(--text-main); }
.qb-ready-variants { display: flex; flex-wrap: wrap; gap: 6px; }
.qb-ready-btn { margin: 0; min-width: 40px; font-size: 13px; padding: 6px 12px; }

/* iPhone сам увеличивает страницу, когда нажимают на поле со шрифтом мельче
   16px, и обратно не уменьшает — выглядит как поломка. На сенсорных экранах
   поля ввода и списки не мельче 16px. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { font-size: 16px !important; }
}

/* Открытое меню на телефоне: карточка «Новые сообщения» рисовалась поверх него */
body:has(.sidebar.sidebar-open) .chat-unread-banner { display: none; }

/* ---- Печатная платёжная ведомость (payroll.html, #payPrintArea) ---- */
.pay-print { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm 10mm 12mm; }
  /* Остальная страница на время печати убирается совсем (display: none), а не
     прячется. Раньше она была скрыта через visibility и продолжала занимать
     место: после ведомости печатались пустые листы — на 75 человек восемь
     листов вместо пяти. Сама ведомость стоит в обычном потоке на всю ширину. */
  body.pay-printing > *:not(.app-shell) { display: none !important; }
  body.pay-printing .app-shell { display: block !important; min-height: 0 !important; }
  body.pay-printing .app-shell > *:not(main), body.pay-printing main > *:not(.pay-print) { display: none !important; }
  body.pay-printing main { display: block !important; margin: 0 !important; padding: 0 !important; width: auto !important; max-width: none !important; min-height: 0 !important; }
  body.pay-printing { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.pay-printing .pay-print { display: block; width: 100%; color: #000; background: #fff; font: 11px/1.3 Arial, Helvetica, sans-serif; }
  .pay-print .pp-head { text-align: center; margin: 0 0 8px; }
  .pay-print .pp-school { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
  .pay-print h1 { font: 700 16px/1.2 Arial, Helvetica, sans-serif; margin: 4px 0 2px; }
  .pay-print .pp-period { font-size: 12px; }
  .pay-print .pp-table { width: 100%; border-collapse: collapse; page-break-inside: auto; }
  .pay-print .pp-table tr { page-break-inside: avoid; }
  .pay-print .pp-table thead { display: table-header-group; }
  .pay-print .pp-table th, .pay-print .pp-table td { border: 1px solid #000; padding: 4px 5px; vertical-align: middle; }
  .pay-print .pp-table th { font-weight: 700; text-align: center; background: #eee; }
  .pay-print .pp-table td.n, .pay-print .pp-table th.n { text-align: right; white-space: nowrap; }
  .pay-print .pp-table td.c { text-align: center; }
  .pay-print .pp-table td.pp-sign, .pay-print .pp-table th.pp-sign { width: 38mm; }
  .pay-print .pp-table tbody td { height: 9mm; }
  .pay-print .pp-table tr.pp-group td { height: auto; font-weight: 700; background: #f3f3f3; padding: 5px 6px; }
  .pay-print .pp-strong { font-weight: 700; }
  .pay-print .pp-pos { font-size: 9px; color: #333; }
  /* Итог — последняя строка таблицы (не tfoot: тот повторялся бы на каждом листе) */
  .pay-print .pp-table tr.pp-total td { font-weight: 700; background: #eee; border-top: 2px solid #000; }
  /* Три суммы под таблицей: всего к выплате, выплачено, осталось выплатить */
  /* Суммы, подписи и «Распечатано» — одним куском: лист с одними подписями без сумм не нужен */
  .pay-print .pp-tail { break-inside: avoid; page-break-inside: avoid; }
  .pay-print .pp-sum { margin: 5mm 0 0 auto; width: 96mm; font-size: 12px; }
  .pay-print .pp-sum-line { display: flex; justify-content: space-between; gap: 8mm; padding: 1.2mm 0; border-bottom: 1px solid #999; }
  .pay-print .pp-sum-line b { white-space: nowrap; }
  .pay-print .pp-sum-strong { font-size: 13.5px; font-weight: 700; border-bottom: 2px solid #000; }
  .pay-print .pp-footer { display: flex; gap: 24px; flex-wrap: wrap; margin: 14mm 0 0; font-size: 12px; }
  .pay-print .pp-printed { margin-top: 6mm; font-size: 9px; color: #333; }
}

/* ---- Библиотека (library.html): вкладки, каталог, карточка читателя, оплата книг ---- */
/* Четыре вкладки на узком телефоне не помещаются в строку — переносятся по две */
@media (max-width: 480px) {
  .lib-tabs { flex-wrap: wrap; }
  .lib-tabs .tab-btn { flex: 1 1 calc(50% - 4px); padding: 9px 8px; }
}
.pay-dialog.lib-wide { max-width: 760px; }

/* ---- «Оплаты за обучение» в карточке ученика и окно «Исправить месяцы оплаты»
   (js/pay-month-fix.js). Клетки — та же сетка, что в кассе (.month-grid,
   .month-checkbox + mc-paid / mc-partial / mc-unpaid), только вместо галочки
   поле суммы. ---- */
.pay-dialog.pmf-dialog { max-width: 680px; }
.pmf-dialog .pmf-cell { align-items: stretch; cursor: default; }
.pmf-dialog .pmf-cell .mc-label { width: 100%; min-width: 0; }
.pmf-dialog .pmf-amt { width: 100%; margin: 2px 0; padding: 5px 8px; font-size: 13px; }
.pmf-dialog .pmf-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.pmf-dialog .pmf-tools .btn-ghost-small { margin: 0; }
.pmf-dialog .pmf-total { margin: 0 0 12px; font-weight: 600; }
.pmf-row .tx-meta { line-height: 1.5; }
.pmf-row-note { color: var(--red); }
.tx-fix-link, .dbt-fix-link { color: var(--green-dark); text-decoration: none; }
.tx-fix-link:hover, .dbt-fix-link:hover { text-decoration: underline; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.lib-chips:empty { display: none; }
.lib-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-main);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.lib-chip:hover { border-color: var(--green); }
.lib-chip.active { background: var(--green); border-color: var(--green); color: #fff; }
.lib-chip .n { opacity: 0.7; margin-left: 2px; }
.lib-lang-quick {
  padding: 4px 6px; font-size: 13px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-main); font-family: inherit; max-width: 130px;
}
.lib-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lib-actions .btn-small, .lib-actions .btn-ghost-small, .lib-actions .btn-cancel-tx { margin: 0; }
.lib-books td { vertical-align: middle; }
.lib-row { flex-wrap: wrap; gap: 8px; }
.lib-row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lib-row-side .btn-small, .lib-row-side .btn-cancel-tx { margin: 0; }
.lib-stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.lib-stat { background: var(--green-wash); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.lib-stat.bad { color: var(--red); }
.lib-section-title { font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.lib-link {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--green-dark);
  cursor: pointer; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px;
}
.lib-link:hover { text-decoration-style: solid; }
.lib-click-row { cursor: pointer; }
.lib-click-row:hover td { background: var(--green-wash); }
.lib-row-dim { opacity: 0.6; }
.lib-group-head {
  display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px;
  margin: 16px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.lib-group-head:first-child { margin-top: 0; }
.tx-amount.lib-debt { color: var(--red); }
.lib-unlinked { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.lib-unlinked-head { margin-bottom: 8px; line-height: 1.5; }
.lib-unlinked-books { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lib-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* Приход сотрудников: ушёл раньше конца смены */
.sa-early { color: var(--red); font-weight: 600; font-size: 12px; line-height: 1.3; }

/* ---- Оплата за уроки (lesson-pay.html, js/lesson-pay.js) ---- */
.lp-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.lp-cat { min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-top: 3px solid var(--lp-accent, var(--green)); border-radius: 12px; background: var(--surface); }
.lp-cat-0 { --lp-accent: #64748b; }
.lp-cat-1 { --lp-accent: #2563eb; }
.lp-cat-2 { --lp-accent: #7c3aed; }
.lp-cat-3 { --lp-accent: #c2410c; }
.lp-cat-name { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--text-main); }
.lp-cat-price-label { display: block; margin: 0 0 4px; font-size: 12px; color: var(--text-secondary); }
.lp-cat .lp-cat-price { margin: 0 0 8px; padding: 8px 10px; }
.lp-cat-sub { margin: 0; font-size: 12px; color: var(--text-secondary); }
.lp-cat-sum { margin: 2px 0 0; font-size: 18px; font-weight: 800; line-height: 1.3; color: var(--text-main); font-variant-numeric: tabular-nums; }
.lp-cur { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.lp-total { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--text-main); }
.lp-add { gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.lp-cat-title { margin: 18px 0 6px; font-size: 15px; font-weight: 700; color: var(--text-main); }
.lp-empty { margin: 0 0 6px; }
.lp-table .lp-num { width: 100%; max-width: 130px; margin: 0; padding: 7px 9px; }
/* Таблицы категорий одна под другой — столбцы одной ширины, чтобы суммы стояли ровно */
@media (min-width: 641px) {
  .lp-table { table-layout: fixed; width: 100%; }
  .lp-table th:nth-child(1) { width: 19%; }
  .lp-table th:nth-child(2) { width: 12%; }
  .lp-table th:nth-child(3) { width: 14%; }
  .lp-table th:nth-child(4) { width: 15%; }
  .lp-table th:nth-child(5) { width: 12%; }
  .lp-table th:nth-child(6) { width: 15%; }
  .lp-table th:nth-child(7) { width: 13%; }
  .lp-table td { overflow-wrap: anywhere; }
  .lp-table td .lp-cat-select { width: 100%; padding-left: 6px; padding-right: 4px; }
}
.lp-table .lp-cat-select { width: auto; margin: 0; padding: 7px 9px; }
.lp-sum { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
#lpDraftNote { background: var(--yellow-light); color: var(--yellow-deep); }
@media (max-width: 900px) { .lp-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  /* Строки таблицы на телефоне — карточки (правило .students-table); итог категории — тоже */
  .lp-table tfoot { display: block; }
  .lp-table .lp-num { width: 120px; max-width: none; }
}

/* ---- Зарплатная ведомость: группы сотрудников (js/staff-groups.js) ---- */
.pay-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.pay-group-tab { border: 1px solid var(--border); background: var(--surface); color: var(--text-main); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease); }
.pay-group-tab span { margin-left: 4px; color: var(--text-secondary); font-weight: 500; }
.pay-group-tab:hover { border-color: var(--green); }
.pay-group-tab.active { background: var(--green); border-color: var(--green); color: #fff; }
.pay-group-tab.active span { color: rgba(255,255,255,.85); }
.pay-table tr.pay-group-head td { background: var(--green-light); color: var(--green-deep); padding: 9px 12px; font-size: 13px; }
.pay-table tr.pay-group-head td b { margin-right: 10px; font-size: 14px; }
.pay-table tr.pay-group-head td span { color: var(--text-secondary); }
.pay-typos { background: var(--yellow-light); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
.pay-typo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid rgba(0,0,0,.06); font-size: 14px; }
.pay-typo:first-of-type { border-top: 0; }
.pay-typo s { color: var(--red); }
.pay-pos-table select.field-input { margin: 0; min-width: 190px; }
@media (max-width: 768px) {
  .pay-table tr.pay-group-head { display: block; }
  .pay-table tr.pay-group-head td { display: block; border-radius: 10px; }
  .pay-table tr.pay-group-head td::before { content: none !important; }
  .pay-typo { flex-direction: column; align-items: flex-start; }
}

/* ---- Библиотека: разделы (полки) и понятный остаток ---- */
.lib-sec-chips { margin-top: -4px; }
.lib-chip.lib-chip-add { border-style: dashed; background: transparent; color: var(--green-dark); }
.lib-books tr.lib-sec-head td { background: var(--green-light); color: var(--green-deep); font-weight: 700; padding: 8px 12px; }
.lib-left b { font-size: 18px; color: var(--green-deep); }
.lib-left span { color: var(--text-secondary); font-size: 13px; }
.lib-left.empty b { color: var(--red); }
.lib-bar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 4px; max-width: 120px; overflow: hidden; }
.lib-bar span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
@media (max-width: 768px) {
  .lib-books tr.lib-sec-head { display: block; }
  .lib-books tr.lib-sec-head td { display: block; border-radius: 10px; text-align: left !important; }
  .lib-books tr.lib-sec-head td::before { content: none !important; }
  .lib-bar { margin-left: auto; }
}

/* ============================================================
   Расписание уроков — редактор (schedule.html, js/schedule-editor.js)
   ============================================================ */
.sched-wide { max-width: none; }
.sched-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.sched-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.sched-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sched-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sched-publish:disabled { opacity: .45; cursor: default; }
.sched-quality { padding-top: 14px; padding-bottom: 14px; }
.sched-qchips { display: flex; flex-wrap: wrap; gap: 8px; }
.sched-qchip { border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--green-wash); color: var(--text-main); border: 1px solid var(--border); }
.sched-qchip b { font-weight: 800; }
.sched-qchip.ok { background: var(--green-light); border-color: transparent; color: var(--green-deep); }
.sched-qchip.bad { background: var(--red-light); border-color: var(--red); color: var(--red); }
.sched-qchip.warn { background: var(--yellow-light); border-color: var(--yellow); color: var(--yellow-deep); }
.sched-qchip.soft { background: var(--surface); }
.sched-warnings { margin-top: 10px; font-size: 13px; color: var(--yellow-deep); }
.sched-warnings p { margin: 3px 0; }
.sched-viewbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.seg-toggle { display: inline-flex; background: var(--green-wash); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.seg-toggle button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--text-secondary); }
.seg-toggle button.active { background: var(--surface); color: var(--text-main); box-shadow: var(--shadow-sm); }
.sched-entity { display: flex; align-items: center; gap: 4px; }
.sched-entity select { margin: 0; min-width: 180px; }
.sched-hint { flex-basis: 100%; margin: 0; }
.sched-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .sched-layout { grid-template-columns: 1fr; } }
.sched-grid-wrap { overflow-x: auto; }

.sched-grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 640px; }
.sched-grid th { font-size: 13px; font-weight: 700; color: var(--text-secondary); padding: 4px; }
.sched-grid th.sg-p { width: 64px; text-align: left; }
.sched-grid th.sg-p b { display: block; color: var(--text-main); font-size: 15px; }
.sched-grid th.sg-p small { font-size: 10.5px; font-weight: 500; }
.sched-grid td.sg-cell { background: var(--green-wash); border: 1px dashed var(--border); border-radius: 10px; height: 62px; padding: 3px; vertical-align: top; transition: background .12s, border-color .12s; }
.sched-grid td.sg-cell.off { background: repeating-linear-gradient(135deg, var(--bg), var(--bg) 6px, var(--border) 6px, var(--border) 7px); }
.sched-grid td.sg-cell.avoid { background: var(--yellow-light); }
.sched-grid tr.lunch-after td, .sched-grid tr.lunch-after th { border-bottom: 3px solid var(--yellow); }
.sched-grid td.dz-ok { background: #dcf7e7; border-color: var(--green); border-style: solid; }
.sched-grid td.dz-soft { background: #fff3cf; border-color: var(--yellow); border-style: solid; }
.sched-grid td.dz-bad { background: #fde3df; border-color: #f1b3aa; }
.sched-grid td.dz-hover { outline: 3px solid var(--green-deep); outline-offset: -1px; }
.sched-grid td.dz-bad.dz-hover { outline-color: var(--red); }

.sl { position: relative; background: var(--sc, var(--surface)); border: 1px solid rgba(0,0,0,.08); border-radius: 8px; padding: 5px 7px; font-size: 12.5px; line-height: 1.25; cursor: grab; touch-action: none; user-select: none; margin-bottom: 3px; color: #1c2a22; }
.sl:last-child { margin-bottom: 0; }
.sl b { display: block; font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl small { display: block; color: #4b5b52; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl .sl-group { display: inline-block; font-size: 10px; background: rgba(255,255,255,.7); border-radius: 6px; padding: 0 5px; margin-top: 1px; }
.sl .sl-lock { position: absolute; top: 3px; right: 5px; font-size: 10px; }
.sl .sl-count { font-weight: 800; color: var(--green-deep); }
.sl.locked { box-shadow: inset 0 0 0 2px rgba(1, 140, 76, .45); cursor: default; }
.sl.selected { box-shadow: 0 0 0 2px var(--green-deep); }
.sl.bad { box-shadow: 0 0 0 2px var(--red); }
.sl.dragging { opacity: .35; }
.sl.tray { margin-bottom: 6px; }
.sl-ghost { position: fixed; z-index: 1000; pointer-events: none; box-shadow: var(--shadow-lg); transform: rotate(-2deg); opacity: .95; }
body.sched-dragging, body.sched-dragging * { cursor: grabbing !important; }
.sched-dragtip { position: fixed; z-index: 1001; max-width: 280px; font-size: 12px; background: #1c2a22; color: #fff; border-radius: 8px; padding: 6px 9px; pointer-events: none; }
.sched-dragtip.bad { background: var(--red); }
.sched-dragtip.soft { background: #8a6508; }
.sched-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 1002; background: #1c2a22; color: #fff; border-radius: 12px; padding: 10px 16px; font-size: 14px; max-width: min(92vw, 560px); transition: opacity .2s, transform .2s; pointer-events: none; }
.sched-toast.show { opacity: 1; transform: translate(-50%, 0); }

.sched-side { display: grid; gap: 12px; }
.sched-card { background: var(--green-wash); border: 1px solid var(--border); border-radius: 14px; padding: 12px; font-size: 13.5px; }
.sched-card p { margin: 4px 0; }
.sched-card-title { font-weight: 800; font-size: 15px; margin: 0 0 6px !important; }
.sched-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.sched-issue { font-size: 12.5px; margin: 3px 0; }
.sched-issue.bad { color: var(--red); }
.sched-issue.warn { color: var(--yellow-deep); }

.sched-school { border-collapse: collapse; font-size: 11px; min-width: 100%; }
.sched-school th, .sched-school td { border: 1px solid var(--border); padding: 3px 2px; text-align: center; min-width: 26px; height: 24px; }
.sched-school thead th { background: var(--green-wash); position: sticky; top: 0; }
.sched-school th.day { font-size: 12px; }
.sched-school .day-start { border-left: 2px solid var(--text-secondary); }
.sched-school tbody th { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 3px 6px; white-space: nowrap; }
.sched-school td.bad { outline: 2px solid var(--red); outline-offset: -2px; }
.sched-school td.off { background: var(--bg); }
.linklike { border: 0; background: none; font: inherit; font-weight: 700; color: var(--green-dark); cursor: pointer; padding: 0; }

.pay-dialog.sched-gen-dialog { max-width: 520px; }
.sched-radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.sched-radio span { display: grid; gap: 2px; }
.sched-radio small { color: var(--text-secondary); font-size: 12.5px; }
.sched-gen-progress .bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 10px 0 6px; }
.sched-gen-progress .bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s linear; }
.sched-ver { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.sched-ver span { display: grid; }
.sched-ver small { color: var(--text-secondary); font-size: 12px; }

/* нагрузка */
.sched-load-form { grid-template-columns: 1.2fr .6fr 1.4fr; }
.sched-class-pick { display: grid; gap: 6px; margin: 4px 0 12px; }
.sched-pick-grade { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sched-pick, .sched-pick-all { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.sched-pick-all { font-weight: 700; background: var(--green-wash); }
.sched-pick.on, .sched-pick-all.on { background: var(--green); border-color: var(--green); color: #fff; }
.sched-teacher-rows { display: grid; gap: 6px; }
.sched-teacher-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
/* строка выровнена по верху (под полем учителя бывает строка-пояснение), а метка
   группы и «✕», у которых нет подписи сверху, опущены к полям */
.sched-teacher-row > .btn-cancel-tx { margin-top: 35px; }
@media (min-width: 641px) { .sched-teacher-row > .sched-group-tag { margin-top: 45px; } }
.sched-teacher-row .grow { flex: 1 1 200px; min-width: 0; }
.sched-teacher-row .field-input { margin-bottom: 0; }
/* Поле «учитель» с подсказками (js/schedule-pick.js): в форме список висит под
   полем поверх следующей панели, в окне «Заменить учителя» стоит в потоке —
   иначе его обрезала бы прокрутка окна */
.sched-tpick-state { margin: 4px 0 0; min-height: 0; }
.sched-tpick-state:empty { display: none; }
.sched-tpick-state.warn { color: var(--red); }
.sched-tpick-none { color: var(--text-secondary); cursor: default; }
.sched-tpick-none:hover { background: none; }
.sched-tpick .sched-also-tag, .sched-tpick .ac-class { margin-left: 2px; }
.sched-teacher-row .autocomplete-list { top: calc(100% + 4px); }
.sched-load-panel { position: relative; z-index: 2; }
.sched-rep-dialog .sched-tpick .field-input { margin-bottom: 0; }
.sched-rep-dialog .sched-tpick { margin-bottom: 12px; }
.sched-rep-dialog .autocomplete-list { position: static; box-shadow: none; margin: 4px 0 0; }
/* Окно стоит от верха экрана, а не по центру: список под полем раскрывается в
   потоке, и окно, выровненное по центру, росло бы в обе стороны — поле уезжало
   бы из-под курсора, а второй щелчок попадал бы в случайную строку списка */
.pay-dialog.sched-rep-dialog { align-self: flex-start; margin-top: 4vh; }
.sched-rep-two > div { min-width: 0; }
.sched-tpick .autocomplete-item { overflow-wrap: anywhere; }
.sched-load-head .sched-also-tag { margin-left: 6px; }
.sched-group-tag { display: inline-block; font-size: 11.5px; font-weight: 700; background: #e9e4ff; color: #4b3aa8; border-radius: 6px; padding: 2px 7px; }
.sched-room-tag { display: inline-block; font-size: 11.5px; background: var(--green-wash); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }
.sched-load-group { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.sched-load-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--green-wash); padding: 9px 12px; }
.sched-load-sum { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.sched-load-sum.over { color: var(--red); }
.sched-load-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.sched-load-subj { font-weight: 700; min-width: 150px; }
.sched-load-who { color: var(--text-secondary); flex: 1 1 160px; }
.sched-hours-input { width: 64px; margin: 0; padding: 6px 8px; }
/* нагрузка: «По предметам» и окно «Заменить учителя» (js/schedule-replace.js) */
.sched-load-head .btn-ghost-small, .sched-load-row .btn-ghost-small { margin: 0; }
.sched-load-head b { margin-right: auto; }
.sched-load-lang { padding: 5px 12px; border-top: 1px solid var(--border); background: var(--bg); font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-secondary); }
.sched-also-tag { display: inline-block; font-size: 11.5px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }
.sched-load-row.by-subject .sched-load-subj { flex: 0 0 230px; }
.sched-load-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; padding: 9px 12px; border-radius: 10px; background: var(--green-wash); border: 1px solid var(--border); font-size: 14px; }
.sched-load-note span { flex: 1 1 320px; }
.sched-load-note .btn-ghost-small { margin: 0; }
.sched-pick small { font-size: 11px; opacity: .7; }
/* тело окна прокручивается, кнопки под ним всегда на виду: на телефоне список строк длиннее экрана */
.pay-dialog.sched-rep-dialog { max-width: 640px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.sched-rep-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 20px 4px; }
.sched-rep-dialog .pay-dialog-actions { flex: 0 0 auto; margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
/* ошибка — между прокручиваемым телом и кнопками: её видно, как бы далеко ни был прокручен список */
.sched-rep-dialog > .login-error { flex: 0 0 auto; margin: 0; padding: 8px 20px; border-top: 1px solid var(--border); }
.sched-rep-dialog > .login-error:empty { display: none; }
.sched-rep-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 10px; }
.sched-rep-chips[data-box="quick"] { margin-bottom: 6px; }
.sched-rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sched-rep-preview { max-height: 230px; overflow-y: auto; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.sched-rep-preview p { margin: 0 0 6px; }
.sched-rep-preview p:last-child { margin-bottom: 0; }
.sched-rep-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 4px 0; border-top: 1px dashed var(--border); }
.sched-rep-hours { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--text-secondary); }
.sched-rep-skip { color: var(--red); }
/* окно «Стандартные предметы» (js/schedule-standard.js) */
.sched-std-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px; }
.sched-std-radio { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; cursor: pointer; }
.sched-std-opts .sched-std-radio { margin: 0; }
.sched-std-list { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; }
.sched-std-list > p { margin: 0; padding: 9px 12px; }
.sched-std-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.sched-std-row:first-child { border-top: 0; }
.sched-std-row.have { cursor: default; color: var(--text-secondary); }
.sched-std-name { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.sched-std-name small { font-size: 12.5px; color: var(--text-secondary); }
.sched-std-note { flex: 0 0 auto; max-width: 46%; text-align: right; font-size: 12.5px; color: var(--text-secondary); }
@media (max-width: 600px) { .sched-rep-two { grid-template-columns: 1fr; gap: 0; } .sched-load-row.by-subject .sched-load-subj { flex-basis: 100%; } .sched-load-head { flex-wrap: wrap; } }
.sched-subj-table select.field-input { margin: 0; min-width: 110px; }
.sched-daylen-row { border-top: 1px solid var(--border); padding: 8px 0; }
.sched-daylen-grade { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sched-daylen-grade select, .sched-daylen-class select { margin: 0; width: auto; padding: 5px 8px; }
.sched-daylen-classes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sched-daylen-class { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }

/* звонки */
.sched-bells { display: grid; gap: 6px; max-width: 460px; }
.sched-bell { display: flex; align-items: center; gap: 8px; }
.sched-bell .field-input { margin: 0; width: 120px; }
.sched-bell-n { width: 24px; font-weight: 800; }
.sched-bell.lunch { border-bottom: 3px solid var(--yellow); padding-bottom: 6px; }
.sched-lunch-tag { font-size: 12px; font-weight: 700; color: var(--yellow-deep); }

/* учителя: доступность */
.sched-teachers-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .sched-teachers-layout { grid-template-columns: 1fr; } .sched-teacher-list { max-height: 220px; } }
.sched-teacher-list { display: grid; gap: 4px; max-height: 560px; overflow-y: auto; }
.sched-tp-item { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 10px; font: inherit; cursor: pointer; display: grid; }
.sched-tp-item small { color: var(--text-secondary); font-size: 12px; }
/* под именем учителя — что он ведёт */
.sched-tp-item em { font-style: normal; font-size: 12.5px; color: var(--green-dark); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
/* выбранный учитель: предмет → классы → часы */
.sched-tp-load { margin: 10px 0 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.sched-tp-load-title { margin: 0 0 6px; font-weight: 700; font-size: 14px; }
.sched-tp-load table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sched-tp-load th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 4px 8px 4px 0; }
.sched-tp-load td { padding: 6px 8px 6px 0; border-top: 1px solid var(--border); vertical-align: top; }
.sched-tp-load th:last-child, .sched-tp-load td.num { text-align: right; white-space: nowrap; padding-right: 0; }
.sched-tp-load tfoot td { font-weight: 600; }
.sched-tp-class { display: inline-block; margin: 0 6px 4px 0; padding: 2px 8px; border-radius: 8px; background: var(--green-light); color: var(--green-deep); font-size: 13px; white-space: nowrap; }
.sched-tp-class i { font-style: normal; font-weight: 700; margin-left: 3px; }
.sched-tp-item.active { border-color: var(--green); background: var(--green-light); }
.sched-tp-item.over small { color: var(--red); }
.sched-tp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.sched-tp-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.sched-tp-max { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.sched-tp-max select { margin: 0; width: auto; }
.sched-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 8px; }
.sched-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sched-legend i.sched-av { width: 16px; height: 16px; display: inline-block; }
.sched-avail-wrap { overflow-x: auto; }
.sched-avail { border-collapse: separate; border-spacing: 4px; }
.sched-avail th button { border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; color: var(--text-main); padding: 4px 6px; display: grid; }
.sched-avail th button small { font-weight: 500; font-size: 10.5px; color: var(--text-secondary); }
.sched-avail tr.lunch-after td { border-bottom: 3px solid var(--yellow); padding-bottom: 4px; }
.sched-av { width: 44px; height: 32px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); cursor: pointer; }
.sched-av.ok { background: #bdeccf; }
.sched-av.avoid { background: #ffe39a; }
.sched-av.no { background: #f4b1a8; }

/* печать */
.sched-print { display: none; }
@media print {
  body.sched-printing > *:not(.sched-print) { display: none !important; }
  body.sched-printing .app-shell { display: block !important; }
  body.sched-printing .app-shell > *:not(main), body.sched-printing main > *:not(.sched-print) { display: none !important; }
  body.sched-printing .sched-print { display: block; }
  body.sched-printing { background: #fff !important; }
  @page { size: A4 landscape; margin: 10mm; }
  .sp-page { page-break-after: always; }
  .sp-page:last-child { page-break-after: auto; }
  .sp-page h2 { font-size: 16pt; margin: 0 0 6mm; }
  .sp-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9.5pt; }
  .sp-table th, .sp-table td { border: 1px solid #000; padding: 3px 4px; vertical-align: top; }
  .sp-table thead th { background: #eee; }
  .sp-table tbody th { width: 22mm; text-align: left; }
  .sp-table tbody th small { display: block; font-weight: 400; font-size: 8pt; }
  .sp-table td div { margin-bottom: 2px; }
  /* Название предмета — крупно: лист вешают на стену и читают издалека */
  .sp-table td b { font-size: 12.5pt; line-height: 1.15; overflow-wrap: anywhere; }
  .sp-table td small { display: block; font-size: 8pt; color: #333; }
  .sp-table tr.lunch-after th, .sp-table tr.lunch-after td { border-bottom: 2.5px solid #000; }
  /* «Тасдиқлайман» и подпись директора — внизу листа справа, от таблицы не отрывается */
  .sp-approve { margin-top: 9mm; display: flex; justify-content: flex-end; align-items: baseline; gap: 4mm; font-size: 11pt; break-inside: avoid; page-break-inside: avoid; }
  .sp-approve b { font-size: 12pt; margin-right: 6mm; }
  .sp-approve i { display: inline-block; width: 62mm; border-bottom: 1px solid #000; }
}

/* «Классы и предметы»: название предмета на печати для русских и узбекских классов */
.sched-print-names { display: grid; gap: 4px; min-width: 190px; }
.sched-print-names label { display: flex; align-items: center; gap: 6px; margin: 0; }
.sched-print-names span { flex: 0 0 34px; font-size: 12px; color: var(--text-secondary); }
.sched-print-names .field-input { margin: 0; padding: 5px 8px; font-size: 13px; }

@media (max-width: 768px) {
  .sched-load-form { grid-template-columns: 1fr; }
  .sched-grid { min-width: 560px; }
  .sched-grid td.sg-cell { height: 54px; }
  .sl { font-size: 11.5px; padding: 4px 5px; }
  .sched-entity { flex: 1 1 100%; }
  .sched-entity select { flex: 1; min-width: 0; }
}

/* расписание: сообщения сетки и подсказка про неразмещённые */
#gridSavedMsg.sched-msg-err { color: var(--red); font-weight: 700; font-size: 14px; }
#gridSavedMsg.sched-msg-ok { color: var(--green-deep); font-weight: 600; font-size: 14px; }
.sched-missing-note { font-size: 12.5px; font-weight: 600; color: var(--yellow-deep); background: var(--yellow-light); border-radius: 8px; padding: 3px 8px; }

/* Контрольный процент из тестов (js/pct-tests.js, class-percents) */
.pct-has-tests::placeholder { color: var(--green-deep); opacity: 1; font-weight: 600; }
.pct-tests-caption { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.pct-tests-caption .link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--green-deep); text-decoration: underline; cursor: pointer; }
.pct-from-tests { text-decoration: underline dotted; text-underline-offset: 3px; }

/* ---- Доля школы в оплате ученика (делёж с партнёром): js/common.js REVENUE_SHARE ----
   «Наш» — зелёная плашка, «с партнёром» — пунктирная: отличаются и без цвета. */
.share-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}
.share-badge.share-full { background: var(--green-light); color: var(--green-dark); border: 1px solid transparent; }
.share-badge.share-split { background: var(--surface); color: var(--text-secondary); border: 1px dashed var(--text-secondary); }
td > .share-badge:first-child { margin-left: 0; }
.share-select {
  /* Без стрелки: колонка узкая, а таблице учеников и так тесно */
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  max-width: 100%;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}
.share-select.share-full { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green); }
.share-select.share-split { background: var(--surface); color: var(--text-main); border: 1px dashed var(--text-secondary); }
.share-select:disabled { opacity: 0.6; cursor: progress; }

/* Блок «Наша доля и партнёр» на дашборде (js/revenue-share.js) */
.rvs-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 14px; }
.rvs-tile { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.rvs-tile .metric-label { margin: 0 0 4px; }
.rvs-value { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.rvs-tile-ours { border-color: var(--green); background: var(--green-wash); }
.rvs-tile-ours .rvs-value { color: var(--green-dark); }
.rvs-pct { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.rvs-table td.rvs-ours { font-weight: 700; color: var(--green-dark); }
.rvs-table tr.rvs-total td { font-weight: 700; border-top: 2px solid var(--border); }
.rvs-plan { margin: 12px 0 6px; font-size: 14px; }
.rvs-who { margin-top: 8px; }
.rvs-who summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.rvs-who-list { margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
.rvs-who-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed var(--border); }
.rvs-who-row:last-child { border-bottom: 0; }
.rvs-who-row > span:last-child { white-space: nowrap; text-align: right; }
@media (max-width: 640px) {
  .rvs-tiles { grid-template-columns: 1fr; }
  .rvs-who-row { flex-direction: column; gap: 2px; }
  .rvs-who-row > span:last-child { text-align: left; }
}

/* «Финансы», панель «Скачать отчёт в Excel»: кнопки периода стоят в строке и
   переносятся на вторую — свои отступы .btn-ghost-small (под форму: 8px сверху,
   16px снизу) раздвигали бы строки кнопок на полпанели. */
#excelQuick { gap: 8px; margin-bottom: 10px; }
#excelQuick .btn-ghost-small { margin: 0; }
#excelDone:empty { display: none; }

/* Касса: операции «из сейфа» и «Перенос» между способами — только админ
   (js/cashier.js). Галочка заметная: оставленная отмеченной, она увела бы
   из кассы дня следующую обычную операцию. Строка такой операции в списке —
   в пунктирной рамке и с серой суммой: она видна, но в итог дня не входит. */
.cash-safe-box { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; font-size: 14px; color: var(--text-main); cursor: pointer; }
.cash-safe-box input { width: 18px; height: 18px; margin: 0; flex: none; }
.cash-safe-box.on { border: 2px solid var(--yellow); background: var(--yellow-light); color: var(--yellow-deep); font-weight: 600; }
.cash-safe-box + .btn-primary { margin-top: 12px; }
.cash-safe-tip { margin: 6px 0 10px; }
.cash-safe-total { margin: 4px 0 0; text-align: right; }
.cash-transfer-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cash-transfer-sides .field-label { margin: 0; }
.cash-transfer-sides .field-label > span { display: block; margin-bottom: 6px; }
.tx-row.tx-safe { border: 1px dashed var(--yellow); border-radius: 10px; padding: 10px; margin: 6px 0; }
.tx-row.tx-safe:last-child { border-bottom: 1px dashed var(--yellow); }
.tx-row.tx-safe .tx-amount { color: var(--text-secondary) !important; }
.tx-safe-mark { color: var(--yellow-deep); font-weight: 600; }
@media (max-width: 480px) { .cash-transfer-sides { grid-template-columns: 1fr; } }

/* ---- Фонды кассы (js/cash-fund.js) ---- */
.fund-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fund-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.fund-name { font-weight: 600; color: var(--text-main); }
.fund-total { font-size: 22px; font-weight: 700; color: var(--text-main); overflow-wrap: anywhere; }
.fund-total.neg { color: var(--red); }
.tx-amount.fund-out { color: var(--red); }

/* ---- Главная админа: «Фонды» (js/dash-fund.js) ----
   Две карточки фондов и «Всего в фондах» в один ряд; у каждого фонда свой
   цвет полосы слева. Суммы — тем же шрифтом, что в «Кассе» выше. */
.fund-dash-panel { margin-bottom: 18px; }
.fund-dash-open { margin: 0 0 0 auto; }
.fund-dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr); gap: 12px; align-items: stretch; }
.fund-dash-grid > .loading-text,
.fund-dash-grid > .cash-error { grid-column: 1 / -1; margin: 0; }
.fund-dash-card {
  --fund-accent: #0f8a6c;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--fund-accent);
  border-radius: 14px;
  background: var(--surface);
}
.fund-dash-card.f1 { --fund-accent: #2563eb; }
.fund-dash-name { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; color: var(--text-main); }
.fund-dash-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--fund-accent); }
.fund-dash-value { font-size: 26px; }
.fund-dash-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fund-dash-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--bg); font-size: 12px; color: var(--text-secondary); }
.fund-dash-chip b { font-weight: 700; color: var(--text-main); }
.fund-dash-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 13px; }
.fund-dash-key { white-space: nowrap; color: var(--text-secondary); }
.fund-dash-val { min-width: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-main); }
.fund-dash-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fund-dash-in { font-weight: 700; color: var(--green-dark); }
.fund-dash-out { font-weight: 700; color: var(--red); }
.fund-dash-sep { margin: 0 6px; color: var(--text-secondary); }
.fund-dash-total { display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 860px) {
  .fund-dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fund-dash-total { grid-column: 1 / -1; }
  .fund-dash-value { font-size: 22px; }
}
@media (max-width: 560px) {
  .fund-dash-grid { grid-template-columns: minmax(0, 1fr); }
}

/* «Приход сотрудников»: терминал назвал человека другим именем (код разошёлся) */
.sa-term-warn { margin-top: 3px; font-size: 12px; line-height: 1.35; font-weight: 600; color: var(--red); }

/* ---- English Unit / Matem Unit (js/unit-marks.js) ---- */
.um-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin: 6px 0 10px; }
.um-controls > div { min-width: 0; }
.um-controls .field-input { margin: 0; }
.um-test-pick { flex: 1 1 260px; }
.um-table .um-pct { width: 72px; margin: 0; padding: 7px 8px; text-align: center; }
@media (max-width: 640px) {
  .um-table .um-pct { width: 100%; }
}
/* Выбор директорских тестов: отмеченные — плашками, ниже список с галочками */
.um-tests { min-width: 0; }
.um-test-chosen { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; margin-bottom: 6px; }
.um-test-chip { padding: 4px 10px; border-radius: 999px; background: var(--green-wash); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-main); }
.um-test-details > summary { display: inline-block; cursor: pointer; list-style: none; margin: 0; }
.um-test-details > summary::-webkit-details-marker { display: none; }
.um-test-details[open] > summary { margin-bottom: 8px; }
.um-test-search { margin: 0 0 6px; }
.um-test-all { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.um-test-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; background: var(--surface); }
.um-test-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.um-test-row:last-child { border-bottom: none; }
.um-test-row input { flex: none; width: 17px; height: 17px; margin: 0; }
.um-unit-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.um-unit-btns .field-label { flex-basis: 100%; }
.um-unit-btns .btn-ghost-small { margin: 0; }
.um-table tfoot .um-avg-row td { border-top: 2px solid var(--border); background: var(--green-wash); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  /* Строки — карточки (правило .students-table); «Средний» — тоже карточкой */
  .um-table tfoot { display: block; }
  .um-table tfoot .um-avg-row td { border-top: none; background: none; }
  .um-table tfoot .um-avg-row { background: var(--green-wash); }
  .um-table tfoot .um-avg-row td.td-actions { display: none; }
}
/* Карточка ученика: его юниты за месяц — «название + процент» */
.um-card { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.um-card-table .um-card-name { margin: 0; min-width: 0; }
.um-card-table td:first-child { width: 60%; }
.um-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; font-size: 14px; }
.um-card-foot .btn-small { margin: 0; }
@media (max-width: 640px) {
  .um-card-table td:first-child { width: 100%; }
  .um-card-table .um-card-name { width: 100%; text-align: left; }
}
.um-info .um-info-teacher { flex: 1 1 260px; }
.um-info .um-info-level { flex: 0 1 200px; }
.um-info .field-input { width: 100%; }

/* ---- Лента для родителей (feed.html, js/feed.js) и обед на кухне ---- */
.fd-pick { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; flex-wrap: wrap; }
.fd-pick-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.fd-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 12px; }
.fd-previews:empty { display: none; }
.fd-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--green-wash); }
.fd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.fd-warn { margin: 6px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--yellow-light); color: var(--yellow-deep); font-size: 13px; line-height: 1.4; }
.fd-progress { height: 6px; border-radius: 99px; background: var(--green-light); overflow: hidden; margin: 4px 0 12px; }
.fd-progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.fd-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .fd-menu-grid { grid-template-columns: 1fr; } }
.fd-reel-preview { width: 100%; max-height: 360px; border-radius: 12px; background: #000; margin-bottom: 12px; }
.fd-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fd-item:last-child { border-bottom: 0; }
.fd-item-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex: none; background: var(--green-wash); }
.fd-item-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fd-item-thumbs img:only-child { grid-column: span 2; grid-row: span 2; }
.fd-thumb-video { grid-column: span 2; grid-row: span 2; display: grid; place-items: center; font-size: 28px; }
.fd-item-body { flex: 1; min-width: 0; }
.fd-item-body p { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
.fd-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--green-deep); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 9000; box-shadow: var(--shadow-md); }
body.dark-theme .fd-toast { color: #06301F; }
.ktl-box { margin-top: 20px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: left; }
.sp-nophoto-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.sp-nophoto-row input { width: 18px; height: 18px; accent-color: var(--green); }
#fdTabs .tab-btn { white-space: nowrap; }
.fd-meal-tabs { margin: 0 0 12px; }

/* Приложение Nihol Academy (Android / iOS): на входе нет перехода на сайты
   филиалов — в приложении только свои экраны (js/common.js niholInApp) */
.nihol-app .login-branch-toggle-btn, .nihol-app .login-branch-menu { display: none !important; }

/* Чат и дневник откроются в оболочке приложения (js/shell-early.js) — пока
   её строит js/parent-shell.js, вид сайта с меню не показываем */
html.pa-shell-wait body { background: #FAFAFA; }
html.pa-shell-wait .app-shell, html.pa-shell-wait .theme-toggle-btn { visibility: hidden; }

/* «Показать пароль»: глаз справа в поле пароля (сайт и приложение) */
.pw-wrap { position: relative; }
.pw-wrap .field-input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 0; width: 36px; height: 42px; border: 0; background: transparent url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%238A9892%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M1%2012s4-7%2011-7%2011%207%2011%207-4%207-11%207S1%2012%201%2012z%27%2F%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%273%27%2F%3E%3C%2Fsvg%3E") center / 20px no-repeat;
  cursor: pointer; opacity: .8; }
.pw-eye.on { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%238A9892%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M3%203l18%2018%27%2F%3E%3Cpath%20d%3D%27M10.6%206.1A10.7%2010.7%200%200%201%2012%206c7%200%2011%206%2011%206a17.5%2017.5%200%200%201-3.2%203.8M6.6%206.6C3.4%208.6%201%2012%201%2012s4%207%2011%207a10.6%2010.6%200%200%200%205.4-1.4%27%2F%3E%3Cpath%20d%3D%27M9.9%209.9a3%203%200%200%200%204.2%204.2%27%2F%3E%3C%2Fsvg%3E"); }

/* ============================================================
   Вход в приложении Nihol Academy (Android / iOS) — тот же светлый стиль,
   что и на сайте (решение владельца 2026-10-27): перелив, эмблема сверху,
   поля — в стеклянной панели снизу. html.nihol-app ставит js/common.js
   (niholInApp). На сайте всё это не действует.
   ============================================================ */
.app-login-note { display: none; }
.nihol-app .login-wrap { padding: 0; gap: 0; flex-direction: column; align-items: stretch; justify-content: flex-end; }
.nihol-app .app-login-hero { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
  padding: calc(24px + env(safe-area-inset-top)) 30px 22px; }
.nihol-app .app-login-hero img { width: 180px; max-width: 52vw; border-radius: 22px; box-shadow: 0 20px 50px rgba(1,174,94,.3); animation: loginFloat 5s ease-in-out infinite; }
.nihol-app .login-hero-app { display: block; color: #4E6A5C; margin: 0; font-size: 15px; line-height: 1.45; }
.nihol-app .login-hero-title, .nihol-app .login-hero-text { display: none !important; }
.nihol-app .login-card { max-width: none; display: flex; flex-direction: column; border-radius: 32px 32px 0 0; border-bottom: 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 60px rgba(20,60,40,.12); animation: loginSheet .7s var(--ease) both; }
@keyframes loginSheet { from { transform: translateY(100%); } }
.nihol-app .login-logo { width: 66px; height: 66px; border-radius: 22px; margin-bottom: 10px; }
.nihol-app .login-logo img { width: 50px; height: 50px; border-radius: 15px; }
.nihol-app .login-title { font-size: 21px; }
.nihol-app .login-subtitle, .nihol-app .theme-toggle-btn { display: none !important; }
.nihol-app .login-title { margin-bottom: 14px; }
.nihol-app #loginForm .field-input { height: 54px; padding-left: 44px; margin-bottom: 14px; background: #fff no-repeat 14px center / 20px; font-size: 16px; }
.nihol-app #loginForm #email { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%238A9892%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%278%27%20r%3D%274%27%2F%3E%3Cpath%20d%3D%27M4%2021c0-4%204-6%208-6s8%202%208%206%27%2F%3E%3C%2Fsvg%3E"); }
.nihol-app #loginForm #password { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%238A9892%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%275%27%20y%3D%2711%27%20width%3D%2714%27%20height%3D%2710%27%20rx%3D%272%27%2F%3E%3Cpath%20d%3D%27M8%2011V7a4%204%200%200%201%208%200v4%27%2F%3E%3C%2Fsvg%3E"); padding-right: 48px; }
.nihol-app .pw-eye { height: 54px; right: 8px; }
.nihol-app #loginBtn { height: 54px; display: flex; align-items: center; justify-content: center; flex-direction: row; gap: 8px; }
.nihol-app #loginBtn::after { content: "→"; position: static; inset: auto; background: none; opacity: 1; transform: none; font-size: 18px; line-height: 1; }
.nihol-app .login-forgot { margin-top: 10px; }
/* Приложение: форма входа ждёт, пока js/auth.js поймёт, вошёл ли человек (js/shell-early.js) */
html.app-auth-wait .login-card { visibility: hidden; }
.login-legal { display: block; text-align: center; font-size: 12px; color: #8A9892; margin: 12px 0 0; }
.nihol-app .login-legal { order: 10; margin: 6px 0 0; }
.nihol-app .login-register { order: 8; margin-top: 12px; }
/* Реклама школы (welcome.html) — только на сайте, приложение её не показывает */
.nihol-app .login-about { display: none; }
/* Регистрация в приложении — не панель снизу, а обычная карточка с прокруткой: форма длинная */
.nihol-app .reg-wrap { justify-content: flex-start; padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom)); }
.nihol-app .reg-card { border-radius: 28px; border-bottom: 1px solid rgba(255,255,255,.95); padding-top: 58px; animation: loginUp .7s var(--ease) both; }
.nihol-app .reg-card .login-subtitle { display: block !important; }
.nihol-app .reg-card .lang-toggle { position: absolute; top: 16px; right: 16px; margin: 0; }
.nihol-app .app-login-note { display: block; order: 9; text-align: center; color: #8A9892; font-size: 13px; line-height: 1.4; margin: 10px 0 0; }
.nihol-app .lang-toggle { position: static; order: 10; align-self: center; margin-top: 14px; background: transparent; border: 0; gap: 6px; padding: 0; }
.nihol-app .lang-toggle-btn { border-radius: 99px; padding: 7px 14px; font-size: 13px; color: #8A9892; }
.nihol-app .lang-toggle-btn.active { background: #DDF8E8; color: #008F50; box-shadow: none; }

/* ============================================================
   «Здоровье» (health.html, js/health.js): медпункт, админ, завуч,
   классный руководитель
   ============================================================ */
.hl-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hl-filters select { width: auto; min-width: 120px; margin: 0; }
.hl-filters input { flex: 1; min-width: 200px; margin: 0; }
.hl-list { display: grid; gap: 6px; }
.hl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-main); font: inherit; cursor: pointer; }
.hl-row:hover, .hl-row.on { border-color: var(--green); background: var(--green-wash); }
.hl-name { font-weight: 600; }
.hl-sub { display: block; font-weight: 400; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.hl-chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.hl-chip.warn { background: #FFF3D6; color: #8A5A00; }
.hl-chip.bad { background: #FDECEC; color: #B42318; }
.hl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.hl-h3 { font-size: 15px; margin: 18px 0 8px; }
.hl-ta { min-height: 52px; resize: vertical; }
.hl-ro { margin: 6px 0 10px; }
.hl-ro p { margin: 2px 0 0; white-space: pre-wrap; }
.hl-parent { background: #EEF6FF; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.hl-parent p { margin: 4px 0; white-space: pre-wrap; }
.hl-row2 { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.hl-row2 > div { width: 120px; }
.hl-check { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 14px; }
.hl-visits { display: grid; gap: 8px; margin-top: 10px; }
.hl-visit { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.hl-visit-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.hl-visit p { margin: 4px 0; white-space: pre-wrap; }
.hl-visit .btn-ghost-small { margin-top: 6px; }
.hl-measure-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.hl-measure-form > div { width: 140px; }
.hl-measure-form .btn-small { margin-bottom: 14px; }
.hl-measure-form .login-error { width: 100%; }
.hl-measures { margin-top: 8px; }
@media (prefers-color-scheme: dark) { .hl-parent { background: #13263A; } .hl-chip.warn { background: #3A2E10; color: #F5C451; } .hl-chip.bad { background: #3A1616; color: #F59E9E; } }

/* Факультативы: проценты группы за месяц (js/electives.js) */
.elc-pct-table .elc-pct-input { width: 72px; margin: 0; padding: 6px 8px; text-align: center; }
.elc-pct-table .elc-pct-input.elc-pct-dirty { border-color: var(--green); background: var(--green-light); }
.elc-pct-table .elc-pct-avg { font-weight: 600; white-space: nowrap; }
