:root {
  --ink: #12161c;
  --ink-soft: #3a4450;
  --paper: #eef1f4;
  --paper-2: #f7f8fa;
  --line: #c9d0d8;
  --asphalt: #1c2430;
  --asphalt-2: #2a3544;
  --amber: #d4a017;
  --amber-deep: #b4840c;
  --steel: #4a6b84;
  --danger: #b42318;
  --ok: #1f7a4c;
  --shadow: 0 18px 50px rgba(18, 22, 28, 0.18);
  --radius: 12px;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    linear-gradient(160deg, #e8ecf1 0%, #dfe5ec 45%, #eef1f4 100%);
  color: var(--ink);
  font-family: var(--font-body);
}

code,
.mono {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
}

.muted {
  color: var(--ink-soft);
}

.brand-mark {
  width: 14px;
  height: 28px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--amber) 0 38%, var(--asphalt) 38% 62%, var(--amber) 62% 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.brand-mark--lg {
  width: 18px;
  height: 36px;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 1.35rem;
  line-height: 1;
}

.brand-name--hero {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  margin-top: 0.55rem;
}

.brand-sub {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

/* Login */
.login-scene {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.login-scene__road {
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 36px,
      rgba(255, 255, 255, 0.55) 36px 52px,
      transparent 52px 88px
    ),
    linear-gradient(180deg, transparent, rgba(28, 36, 48, 0.55) 18%, var(--asphalt) 55%);
  mask-image: linear-gradient(180deg, transparent, #000 35%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.55s ease both;
}

.login-card .login-panel {
  flex: 1 1 280px;
  width: auto;
  min-width: 0;
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 2rem 1.75rem 1.75rem;
}

.login-foto {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(160deg, #f3f5f8, #e7ebf0);
  min-height: 260px;
  padding: 1rem 0.85rem 1.15rem;
  position: relative;
}

.login-foto__frame {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 160px;
}

.login-foto__img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(18, 22, 28, 0.12);
}

.login-foto__img.is-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.login-foto__placeholder {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  padding: 0 0.75rem;
}

.login-foto__fio {
  margin: 0;
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--ink);
  word-break: break-word;
}

.login-panel__head {
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-panel__head--brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  text-align: left;
}

.login-panel__head--brand .brand-logo {
  margin: 0;
  flex-shrink: 0;
}

.login-panel__brand-text {
  min-width: 0;
}

.login-panel__head--brand .brand-name--hero {
  font-size: clamp(1.45rem, 3.2vw, 1.95rem);
  margin-top: 0;
}

.login-panel__head--brand .login-panel__lead {
  margin: 0.35rem 0 0;
  max-width: none;
}

.login-panel__head .brand-logo {
  margin-left: auto;
  margin-right: auto;
}

.login-panel__head--brand .brand-logo {
  margin-left: 0;
  margin-right: 0;
}

.login-panel__head .brand-name {
  color: var(--ink);
}

.login-panel__lead {
  margin: 0.65rem auto 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 28ch;
}

.login-panel__hint {
  margin: -0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-legal {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.login-legal a {
  color: var(--steel);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-legal a:hover {
  color: var(--amber-deep);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.field-row select {
  flex: 1;
  min-width: 0;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(74, 107, 132, 0.18);
}

.field-secret {
  position: relative;
  display: block;
  min-width: 0;
}

.field-secret input {
  padding-right: 2.4rem;
}

.field-secret__toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 2.15rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.field-secret__toggle:hover {
  color: var(--ink);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--amber);
  color: var(--asphalt);
}

.btn--primary:hover:not(:disabled) {
  background: var(--amber-deep);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--steel);
  color: var(--ink);
}

.btn--block {
  width: 100%;
  margin-top: 0.25rem;
}

.btn--icon {
  width: 2.75rem;
  padding-left: 0;
  padding-right: 0;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.form-error {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fdecea;
  color: var(--danger);
  font-size: 0.9rem;
}

/* Cabinet shell — светлый стиль как magistralauto.ru (ЛК ученика) */
.page-cabinet {
  --site-blue: #1a6bb5;
  --site-red: #d32f2f;
  --site-yellow: #f0c020;
  --site-ink: #243038;
  --site-muted: #6a7682;
  --site-line: #e2e7ec;
  --site-bg: #eef2f5;
  --site-panel: #ffffff;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--site-bg);
  color: var(--site-ink);
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo--lg {
  width: 72px;
  height: 72px;
}

.page-cabinet .topbar__brand .brand-sub {
  color: var(--site-muted);
  margin-top: 0.15rem;
}

.page-cabinet .brand-mark {
  background: linear-gradient(
    180deg,
    var(--site-red) 0 34%,
    #f0c020 34% 66%,
    var(--site-blue) 66% 100%
  );
}

.page-cabinet .topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.1rem;
  background: var(--site-panel);
  color: var(--site-ink);
  border-bottom: 1px solid var(--site-line);
  box-shadow: 0 1px 0 rgba(36, 48, 56, 0.04);
  position: relative;
  z-index: 200;
  animation: slide-down 0.4s ease both;
}

.page-cabinet .brand-logo {
  width: 72px;
  height: 72px;
}

.page-cabinet .topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-width: 0;
}

.page-cabinet .topbar__brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  min-width: 0;
  min-height: 72px;
}

.page-cabinet .topbar__brand .brand-name {
  color: var(--site-ink);
  font-size: 1.2rem;
  line-height: 1.05;
  margin: 0;
}

.page-cabinet .topbar__brand .brand-sub {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  color: var(--site-muted);
  margin-top: 0.12rem;
  line-height: 1.2;
  min-width: 0;
}

.brand-sub__fio,
.brand-sub__filial {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}

.brand-sub__fio {
  font-weight: 600;
  color: var(--site-ink, #243038);
  font-size: 0.82rem;
}

.brand-sub__filial {
  font-size: 0.75rem;
}

.topbar__brand-text {
  min-width: 0;
}

.page-cabinet .user-meta strong {
  color: var(--site-ink);
}

.page-cabinet .user-meta span {
  color: var(--site-muted);
}

.page-cabinet .topbar .btn--ghost {
  color: var(--site-ink);
  border-color: var(--site-line);
  background: transparent;
}

.page-cabinet .topbar .btn--ghost:hover:not(:disabled) {
  color: var(--site-blue);
  border-color: var(--site-blue);
  background: rgba(26, 107, 181, 0.06);
}

.page-cabinet .panel {
  background: var(--site-panel);
  border-color: var(--site-line);
  color: var(--site-ink);
}

.page-cabinet .panel h2 {
  color: var(--site-ink);
}

.page-cabinet .panel .meta {
  color: var(--site-muted);
}

.page-cabinet .placeholder-box {
  border-color: var(--site-line);
  background: #fafbfc;
  color: var(--site-muted);
}

.topbar__tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  padding: 0;
  background: transparent;
  border: none;
}

/* Кабинет ученика: верхняя полоса + меню слева (сворачивается влево) */
.cabinet-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  min-height: 0;
  align-items: stretch;
  position: relative;
}

.side-nav-backdrop {
  display: none;
}

.side-nav-slot {
  position: relative;
  flex: 0 0 240px;
  width: 240px;
  max-width: 240px;
  align-self: stretch;
  overflow: hidden;
  background: var(--site-panel, #fff);
  border-right: 1px solid var(--site-line, #e2e7ec);
  transition: flex-basis 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.side-nav-clip {
  width: 240px;
  height: 100%;
  overflow: hidden;
}

.side-nav {
  width: 240px;
  height: 100%;
  padding: 0.75rem 0.55rem;
  background: var(--site-panel, #fff);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.22s ease;
}

.page-cabinet.is-nav-closed .side-nav-slot {
  flex-basis: 0;
  width: 0;
  max-width: 0;
  border-right-color: transparent;
}

.page-cabinet.is-nav-closed .side-nav {
  transform: translateX(-100%);
}

.side-nav__toggle {
  position: fixed;
  z-index: 190;
  top: 50%;
  left: 240px;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--site-line, #e2e7ec);
  border-radius: 999px;
  background: #fff;
  color: var(--site-blue, #1a6bb5);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(18, 22, 28, 0.12);
}

.side-nav__toggle:hover {
  border-color: var(--site-blue, #1a6bb5);
  background: rgba(26, 107, 181, 0.06);
}

.side-nav__toggle-icon {
  display: block;
  transition: transform 0.22s ease;
}

.page-cabinet.is-nav-closed .side-nav__toggle {
  left: 0.7rem;
  transform: translateY(-50%);
}

.page-cabinet.is-nav-closed .side-nav__toggle-icon {
  transform: rotate(180deg);
}

@media (min-width: 1101px) {
  .page-cabinet.is-nav-closed .const-modal--wide {
    left: clamp(1rem, 3vw, 1.75rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .side-nav-slot,
  .side-nav,
  .side-nav__toggle,
  .side-nav__toggle-icon {
    transition: none;
  }
}

.side-nav__btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--site-ink, #243038);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.side-nav__btn:hover {
  background: rgba(26, 107, 181, 0.06);
  color: var(--site-blue, #1a6bb5);
}

.side-nav__btn.active {
  background: rgba(26, 107, 181, 0.1);
  border-color: rgba(26, 107, 181, 0.35);
  color: var(--site-blue, #1a6bb5);
  font-weight: 600;
}

.side-nav__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--site-blue, #1a6bb5);
}

.side-nav__btn.active .side-nav__icon {
  color: var(--site-blue, #1a6bb5);
}

.side-nav__label {
  line-height: 1.25;
}

.cabinet-body > .workspace {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
}

.cabinet-body > .workspace > .panel {
  max-width: none;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
}

.topbar__balance {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.3rem 0.35rem 0.3rem 0.6rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(26, 107, 181, 0.08), rgba(240, 192, 32, 0.1));
  border: 1px solid var(--line);
}

.topbar__balance-info {
  display: grid;
  line-height: 1.15;
  text-align: right;
}

.topbar__balance-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, var(--site-muted, #6b7280));
}

.topbar__balance-value {
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
}

.topbar__balance-value.is-neg,
.stu-metric__value.is-neg {
  color: var(--danger, #b42318);
}

.topbar__balance-value.is-zero,
.stu-metric__value.is-zero {
  color: var(--site-blue, #1a6bb5);
}

.topbar__balance-value.is-pos,
.stu-metric__value.is-pos {
  color: var(--ok, #1f7a4c);
}

.topbar__balance-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.55rem;
  min-width: auto;
  font-size: 0.78rem;
}

.topbar__balance-refresh-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
}

.topbar__balance-refresh-svg {
  width: 100%;
  height: 100%;
}

.page-cabinet .topbar__balance {
  border-color: var(--site-line, var(--line));
}

.page-cabinet .topbar__balance-label {
  color: var(--site-muted);
}

.avatar-wrap {
  position: relative;
}

.avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: var(--asphalt-2);
  display: grid;
  place-items: center;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.avatar-btn:hover,
.avatar-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.35);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-img.is-hidden,
.profile-pop__foto.is-hidden,
.profile-pop__foto-ph.is-hidden {
  display: none !important;
}

.avatar-fallback {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.04em;
}

.profile-pop {
  /* fixed — поверх toolbar/panel/виджетов, не клипается stacking context шапки */
  position: fixed;
  right: 1rem;
  top: 3.75rem;
  width: min(360px, 94vw);
  /* высота ограничивается JS (место до низа экрана); запасной потолок — viewport */
  max-height: min(86vh, 720px);
  max-height: min(86dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1rem 0.95rem 0.95rem;
  z-index: 1000;
  animation: rise 0.2s ease both;
}

.profile-pop__foto-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.profile-pop__foto,
.profile-pop__foto-ph {
  width: min(220px, 70vw);
  height: min(220px, 70vw);
  border-radius: 10px;
  flex-shrink: 0;
  border: 3px solid rgba(212, 160, 23, 0.65);
  box-shadow: 0 8px 24px rgba(18, 22, 28, 0.12);
}

.profile-pop__foto {
  object-fit: cover;
  object-position: center;
  background: #eef1f4;
}

.profile-pop__foto-ph {
  display: grid;
  place-items: center;
  background: #eef1f4;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}

.profile-pop__foto-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.profile-pop__upload {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.profile-pop__who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  margin-bottom: 0.85rem;
  min-width: 0;
}

.profile-pop__who-text {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  text-align: left;
}

.profile-pop__who strong {
  font-size: 1.02rem;
  line-height: 1.25;
}

.profile-pop__job {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--steel);
}

.profile-pop__form {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.profile-pop__form-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.profile-pop .field input {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
}

.profile-pop .field-secret input {
  padding-right: 2.2rem;
}

.profile-pop .btn--block {
  margin-top: 0.15rem;
}

.profile-pop__logout {
  flex-shrink: 0;
  margin: 0;
}

.topbar .btn--ghost {
  color: rgba(237, 241, 245, 0.85);
  border-color: rgba(237, 241, 245, 0.25);
  padding: 0.45rem 0.75rem;
}

.topbar .btn--ghost:hover:not(:disabled) {
  color: #fff;
  border-color: var(--amber);
}

.topbar__logout {
  flex-shrink: 0;
  white-space: nowrap;
}

.profile-pop .btn--ghost {
  color: var(--ink-soft);
  border-color: var(--line);
}

.user-meta {
  display: grid;
  text-align: right;
  line-height: 1.25;
}

.user-meta strong {
  font-size: 0.88rem;
}

.user-meta span {
  font-size: 0.72rem;
  color: rgba(237, 241, 245, 0.6);
}

.section-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(237, 241, 245, 0.72);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 0.86rem;
  white-space: nowrap;
}

.section-tab:hover {
  background: rgba(212, 160, 23, 0.18);
  color: #fff;
}

.section-tab.active {
  background: rgba(212, 160, 23, 0.28);
  color: #fff;
  font-weight: 600;
}

.toolbar {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.85rem;
  min-height: 2.6rem;
  overflow-x: auto;
  position: relative;
  z-index: 50;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.toolbar-sep {
  width: 1px;
  height: 1.6rem;
  background: var(--line);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

.toolbar-empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.btn.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  padding: 0.32rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 8px;
}

.btn.toolbar-btn:hover:not(:disabled) {
  border-color: var(--steel);
  background: #f3f6f9;
}

.btn.toolbar-btn.kind-subsection.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--asphalt);
}

.btn.toolbar-btn.kind-action:active:not(:disabled) {
  background: #e8eef4;
}

.toolbar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.toolbar-label {
  white-space: nowrap;
}

.workspace {
  flex: 1;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 2rem;
}

.panel {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  min-height: 280px;
  box-shadow: 0 8px 28px rgba(18, 22, 28, 0.06);
  animation: rise 0.45s ease both;
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.1;
}

.panel .meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}

.placeholder-box {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: #fff;
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  z-index: 1100;
  background: var(--asphalt);
  color: #edf1f5;
  border: 1px solid rgba(212, 160, 23, 0.55);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  max-width: min(420px, 92vw);
  animation: toast-in 0.25s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  .login-card {
    flex-direction: column;
  }

  .login-card .login-panel {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .login-foto {
    flex-basis: auto;
    min-height: 200px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .topbar__user {
    margin-left: 0;
  }

  .topbar__balance-refresh-text {
    display: none;
  }

  .user-meta {
    text-align: left;
  }
}

/* Рабочий стол виджетов (Delphi vidjet / rs1) — без смены общей темы */
.panel.panel--widgets {
  max-width: none;
  min-height: min(70vh, 640px);
  background-color: var(--paper-2);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.widgets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-start;
}

.widget-card {
  background: rgba(247, 248, 250, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(18, 22, 28, 0.08);
  overflow: hidden;
  width: max-content;
  max-width: 100%;
  min-width: min(280px, 100%);
}

.widget-card__head {
  margin: 0;
  padding: 0.35rem 0.45rem 0.35rem 0.7rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--asphalt);
  color: #edf1f5;
  border-bottom: 2px solid var(--amber);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.widget-card__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-card__refresh {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid rgba(237, 241, 245, 0.25);
  border-radius: 6px;
  background: transparent;
  color: #edf1f5;
  cursor: pointer;
}

.widget-card__refresh:hover:not(:disabled) {
  border-color: var(--amber);
  color: var(--amber);
}

.widget-card__refresh:disabled {
  opacity: 0.45;
  cursor: default;
}

.widget-card__refresh-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.widget-card__body {
  padding: 0.65rem 0.75rem 0.8rem;
  font-size: 0.88rem;
  width: max-content;
  max-width: 100%;
  min-width: 100%;
  box-sizing: border-box;
}

.widget-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.widget-table td {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(201, 208, 216, 0.55);
  vertical-align: top;
}

.widget-table__num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.widget-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.widget-foto-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 6px;
}

.widget-foto-ph {
  color: var(--ink-soft);
  padding: 1.5rem 0.5rem;
  text-align: center;
}

.widget-cal-date {
  margin: 0;
  text-transform: capitalize;
}

.widget-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(18, 22, 28, 0.35);
}

.widget-picker {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 910;
  min-width: 280px;
  max-width: min(420px, 94vw);
  max-height: min(80vh, 560px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem 0.95rem;
  box-shadow: var(--shadow);
}

.widget-picker__title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.widget-picker__row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.widget-picker__close {
  margin-top: 0.75rem;
  width: 100%;
}

.const-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 910;
  width: min(920px, 94vw);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  color: var(--ink);
}

.stu-confirm-overlay {
  z-index: 980;
}

.stu-confirm-modal {
  z-index: 990;
  width: min(480px, 92vw);
  max-height: min(80vh, 520px);
}

/* Блок согласия (первый вход) — поверх кабинета, без закрытия по Esc/backdrop */
.legal-gate-overlay {
  z-index: 1000;
  pointer-events: auto;
}

.legal-gate {
  z-index: 1001;
  width: min(520px, 94vw);
}

.legal-gate__check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.65rem 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
}

.legal-gate__check input {
  margin: 0.2rem 0 0;
  flex: 0 0 auto;
}

.legal-gate__text a {
  color: var(--steel);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-gate__text a:hover {
  color: var(--amber-deep);
}

.legal-gate .form-error {
  margin-top: 0.75rem;
}

.legal-docs__list {
  margin: 0.5rem 0 0;
  padding: 0 0 0 1.15rem;
  color: var(--ink);
}

.legal-docs__item {
  margin: 0.35rem 0;
  line-height: 1.4;
}

.legal-docs__item a {
  color: var(--steel);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-docs__item a:hover {
  color: var(--amber-deep);
}

.legal-docs__status {
  margin-top: 0.75rem;
}

/* Белая страница: принять согласие или выйти (без ФИО / кабинета) */
.legal-accept {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.legal-accept__box {
  width: min(520px, 100%);
}

.legal-accept__title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.15;
}

.legal-accept__lead {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.legal-accept__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.legal-accept .form-error {
  margin-top: 0.85rem;
}

/* Страницы /legal/* — текст соглашения и согласия на ПДн */
.legal-page {
  min-height: 100vh;
  box-sizing: border-box;
  padding: 1rem clamp(0.75rem, 3vw, 1.5rem) 2rem;
  background: radial-gradient(1200px 500px at 10% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    linear-gradient(160deg, #e8ecf1 0%, #dfe5ec 45%, #eef1f4 100%);
  color: var(--ink);
}

.legal-page__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 820px;
  margin: 0 auto 1rem;
}

.legal-page__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.legal-page__brand .brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.legal-page__card {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 1.5rem;
}

.legal-page__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  line-height: 1.15;
}

.legal-page__lead {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.legal-page__card h2 {
  margin: 1.35rem 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.legal-page__card h3 {
  margin: 0.9rem 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.legal-page__card p,
.legal-page__card li {
  line-height: 1.5;
}

.legal-page__card p {
  margin: 0.45rem 0;
}

.legal-page__card ul,
.legal-page__olist {
  margin: 0.35rem 0 0.55rem;
  padding-left: 1.25rem;
}

.legal-page__card a {
  color: var(--steel);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-page__foot {
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.const-modal--wide {
  /* Workspace: отступы слева/справа/сверху/снизу — растягивается, не на весь экран */
  left: calc(240px + clamp(1rem, 3vw, 1.75rem));
  right: clamp(1rem, 3vw, 1.75rem);
  top: clamp(0.75rem, 2vh, 1.25rem);
  bottom: clamp(0.75rem, 2vh, 1.25rem);
  transform: none;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.const-modal--wide .const-modal__head {
  flex: 0 0 auto;
}

.const-modal--wide .stu-card__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.const-modal--wide .stu-card__body > * {
  flex: 0 0 auto;
  max-width: 100%;
}

.const-modal--wide .stu-card__body > .stu-zapis-grid-host,
.const-modal--wide .stu-card__body > .table-wrap,
.const-modal--wide .stu-card__body > .stu-zapis-instr-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.const-modal--wide .stu-card__body > .stu-userdoc-form {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

.const-modal--wide .stu-zapis-grid-host .stu-zapis-grid-wrap,
.const-modal--wide .stu-zapis-instr-wrap,
.const-modal--wide .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: auto;
}

.const-modal--wide .stu-zapis-chrome,
.const-modal--wide .stu-zapis-lead,
.const-modal--wide .stu-zapis-nav,
.const-modal--wide .stu-zapis-legend {
  width: 100%;
}

.const-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  position: sticky;
  top: 0;
  /* Выше sticky-шапки сетки (z-index 3–4), иначе список месяца уходит под полоску времени. */
  z-index: 6;
  background: #fff;
}

.const-modal__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.const-modal__head-main {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.stu-zapis-title-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  gap: 0;
}

.stu-zapis-month-hint {
  display: none;
  position: relative;
  appearance: none;
  border: none;
  background: transparent;
  align-items: center;
  gap: 0.12rem;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-ui, inherit);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft, #5a6570);
  line-height: 1.2;
}

.stu-zapis-month-hint__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stu-zapis-month-hint__tri {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--ink);
}

.stu-zapis-month-hint:hover .stu-zapis-month-hint__text {
  color: var(--steel);
}

.const-modal.is-zapis-compact:not(:has(.stu-zapis-chrome.is-open)) .stu-zapis-month-hint {
  display: inline-flex;
}

.stu-zapis-counters {
  display: none;
  font-family: var(--font-ui, inherit);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-soft, #5a6570);
  line-height: 1.3;
}

.stu-zapis-chrome.is-compact.is-open .stu-zapis-counters {
  display: block;
}

.widgets-empty {
  background: rgba(247, 248, 250, 0.9);
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.widget-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
}

.widget-period__day {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.widget-period__lbl {
  color: var(--ink-soft);
}

.widget-period__date {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.15rem 0.3rem;
  background: #fff;
  max-width: 8.2rem;
}

.widget-period__date:disabled {
  opacity: 0.55;
  background: #f0f2f4;
}

.widget-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
}

.widget-tab {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.widget-tab.active {
  background: var(--asphalt);
  border-color: var(--asphalt);
  color: #edf1f5;
  box-shadow: inset 0 -2px 0 var(--amber);
}

.widget-tab:hover:not(.active) {
  border-color: var(--amber);
}

.widget-data {
  min-height: 2rem;
}

.widget-auto-meta {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
}

.widget-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--ink-soft);
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--line);
}

.notes-panel .notes-area {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

.notes-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.const-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.const-table th,
.const-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.4rem;
  vertical-align: top;
  text-align: left;
}

.const-table th {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.const-str {
  width: 100%;
  min-width: 160px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  resize: vertical;
}

.const-table .mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
}

/* Профиль ученика — карточки баланса */
.stu-profile {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stu-profile__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--site-ink, var(--ink));
  line-height: 1.1;
}

.stu-card {
  background: var(--site-panel, #fff);
  border: 1px solid var(--site-line, var(--line));
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(36, 48, 56, 0.06);
  overflow: hidden;
}

.stu-card__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--site-line, var(--line));
  background: linear-gradient(180deg, #f7fafc 0%, #fff 100%);
}

.stu-card__head:last-child {
  border-bottom: none;
}

.stu-card__balance {
  margin-left: auto;
  flex: 0 0 auto;
  text-align: right;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(26, 107, 181, 0.1), rgba(240, 192, 32, 0.12));
  border: 1px solid rgba(26, 107, 181, 0.18);
  width: max-content;
  max-width: 42%;
}

.stu-card__balance-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--site-muted, var(--ink-soft));
  margin-bottom: 0.15rem;
  white-space: nowrap;
}

.stu-card__balance-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--site-blue, #1a6bb5);
  line-height: 1.1;
  white-space: nowrap;
}

.stu-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.stu-card__balance-value.is-neg {
  color: var(--danger, #b42318);
}

.stu-card__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(26, 107, 181, 0.1);
  color: var(--site-blue, #1a6bb5);
}

.stu-card__icon svg {
  width: 20px;
  height: 20px;
}

.stu-card__heading {
  min-width: 0;
  flex: 1;
}

.stu-card__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.stu-card__title-row .stu-card__name {
  margin: 0;
}

.stu-userdoc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.65rem;
}

.stu-userdoc__lead {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}

.stu-userdoc__head .stu-card__heading {
  min-width: 0;
}

.stu-docs .stu-userdoc-wrap {
  align-items: stretch;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.stu-userdoc {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stu-userdoc .stu-sheet__wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stu-sheet--userdoc {
  width: 100%;
}

.stu-sheet--userdoc td:nth-child(2) {
  white-space: normal;
  min-width: 8rem;
  max-width: 16rem;
}

.stu-sheet--userdoc th:nth-child(1),
.stu-sheet--userdoc td:nth-child(1) {
  width: 1.75rem;
  text-align: center;
}

.stu-sheet--userdoc th:nth-child(7),
.stu-sheet--userdoc td:nth-child(7),
.stu-sheet--userdoc th:nth-child(8),
.stu-sheet--userdoc td:nth-child(8) {
  text-align: right;
  white-space: nowrap;
}

.stu-userdoc__pct {
  min-width: 7.5rem;
  vertical-align: middle;
}

.stu-userdoc__pct-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 7rem;
}

.stu-userdoc__pct-bar {
  flex: 1 1 auto;
  height: 6px;
  min-width: 3.5rem;
  border-radius: 999px;
  background: var(--site-line, #e2e7ec);
  overflow: hidden;
}

.stu-userdoc__pct-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--amber, #d4a017);
  transition: width 0.25s ease;
}

.stu-userdoc__pct-val {
  flex: 0 0 auto;
  min-width: 2.4rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--site-muted, var(--ink-soft));
  text-align: right;
}

.stu-userdoc__col-main {
  width: 1.6rem;
  text-align: center;
  padding-right: 0.15rem !important;
}

.stu-userdoc__main-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--amber-deep, #a67c00);
}

.stu-userdoc__main-mark svg {
  width: 1rem;
  height: 1rem;
}

.stu-userdoc__kind {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
}

.stu-userdoc__sub {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-userdoc__ser {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stu-userdoc__fields {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  padding: 0.35rem 0 0.35rem 1.35rem;
  font-size: 0.88rem;
}

.stu-userdoc__fields dt {
  margin: 0;
  color: var(--site-muted, var(--ink-soft));
}

.stu-userdoc__fields dd {
  margin: 0;
  color: var(--site-ink, var(--ink));
}

.stu-userdoc-types {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.stu-userdoc__act {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.stu-userdoc__del {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  padding: 0.25rem 0.45rem;
}

.stu-userdoc-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.65rem;
  width: 100%;
  max-width: none;
  align-content: start;
  overflow: auto;
  min-height: 0;
  box-sizing: border-box;
}

.stu-userdoc-form > .stu-userdoc-form__lead,
.stu-userdoc-form > .stu-userdoc-form__note,
.stu-userdoc-form > .stu-userdoc-form__actions,
.stu-userdoc-form > .stu-attach,
.stu-userdoc-form > .stu-docs__lead {
  grid-column: 1 / -1;
}

.stu-userdoc-form__span2 {
  grid-column: span 2;
}

.stu-userdoc-form__span3 {
  grid-column: 1 / -1;
}

.stu-userdoc-form > .field {
  width: 100%;
  min-width: 0;
  margin: 0;
  gap: 0.15rem;
}

.stu-userdoc-form > .field > span {
  font-size: 0.78rem;
  line-height: 1.2;
}

.stu-userdoc-form > .field input,
.stu-userdoc-form > .field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
}

.stu-userdoc-form__lead {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-userdoc-form__note {
  margin: 0.15rem 0 0;
  color: var(--site-muted, var(--ink-soft));
  font-size: 0.8rem;
}

.stu-userdoc-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

@media (max-width: 720px) {
  .stu-userdoc-form {
    grid-template-columns: 1fr 1fr;
  }

  .stu-userdoc-form__span2,
  .stu-userdoc-form__span3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .stu-userdoc-form {
    grid-template-columns: 1fr;
  }
}

.stu-card__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--site-ink, var(--ink));
  line-height: 1.15;
}

.stu-card__sub {
  margin: 0.2rem 0 0;
  color: var(--site-muted, var(--ink-soft));
  font-size: 0.88rem;
}

.stu-card__id {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--site-muted, var(--ink-soft));
}

.stu-training {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.stu-card__body--training {
  align-items: flex-start;
}

.stu-training__btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.7rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

.stu-training__list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
}

.stu-training-card {
  border: 1px solid var(--site-line, var(--line));
  border-radius: 12px;
  background: #fafbfc;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.stu-training-card__btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.stu-training-card__btn:hover {
  background: rgba(26, 107, 181, 0.05);
}

.stu-training-card__name {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  flex: 1 1 auto;
  min-width: 0;
}

.stu-training-card__filial {
  font-size: 0.82rem;
  color: var(--site-muted, var(--ink-soft));
  white-space: nowrap;
}

.stu-training-card__chevron {
  color: var(--site-blue, #1a6bb5);
  transition: transform 0.15s ease;
}

.stu-training-card.is-open .stu-training-card__chevron {
  transform: rotate(180deg);
}

.stu-training-card__panel {
  border-top: 1px solid var(--site-line, var(--line));
  padding: 0.65rem 0.9rem 0.8rem;
  background: #fff;
}

.stu-training-services {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stu-training-services li {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.86rem;
  color: var(--site-ink, var(--ink));
}

.stu-training-services__name {
  min-width: 0;
}

.stu-training-services__type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--site-muted, var(--ink-soft));
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(26, 107, 181, 0.08);
  border: 1px solid rgba(26, 107, 181, 0.14);
}

.stu-card__body {
  padding: 0.95rem 1.15rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
}

.stu-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
}

.stu-fact {
  background: #f7fafc;
  border: 1px solid var(--site-line, var(--line));
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  min-width: 6.5rem;
}

.stu-fact__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--site-muted, var(--ink-soft));
  margin-bottom: 0.2rem;
}

.stu-fact__value {
  display: block;
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  font-size: 0.95rem;
  word-break: break-word;
}

.stu-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stu-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--site-line, var(--line));
  background: #fff;
  color: var(--site-ink, var(--ink));
  font-size: 0.88rem;
}

.stu-chip svg {
  color: var(--site-blue, #1a6bb5);
}

.stu-prog {
  border: 1px solid var(--site-line, var(--line));
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #fafbfc;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: min(100%, 22rem);
  box-sizing: border-box;
}

.stu-prog__name {
  margin: 0 0 0.55rem;
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  font-size: 0.95rem;
  line-height: 1.35;
}

.stu-metrics-wrap {
  width: auto;
  max-width: 100%;
  overflow-x: auto;
}

.stu-metrics {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 0.45rem;
  width: auto;
}

.stu-metric {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--site-line, var(--line));
  min-width: 5.25rem;
  max-width: 8.5rem;
}

.stu-metric__label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--site-muted, var(--ink-soft));
  margin-bottom: 0.3rem;
  white-space: nowrap;
}

.stu-metric__value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--site-ink, var(--ink));
  line-height: 1.15;
  white-space: nowrap;
}

.stu-metric--paid .stu-metric__value {
  color: var(--ok, #1f7a4c);
}

.stu-metric--debt .stu-metric__value {
  color: var(--danger, #b42318);
}

.stu-metric--debt.is-zero .stu-metric__value {
  color: var(--site-muted, var(--ink-soft));
}

.stu-metrics:has(.stu-metric--pay) {
  grid-template-columns: repeat(4, auto);
}

a.stu-metric--pay {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.stu-metric--pay:hover {
  border-color: rgba(31, 122, 76, 0.35);
  background: #f4faf6;
}

.stu-metric--pay .stu-metric__value {
  color: var(--ok, #1f7a4c);
}

.stu-prog--balance .stu-metrics-wrap {
  width: 100%;
  overflow: visible;
}

.stu-metrics--balance {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
}

.stu-prog--balance .stu-metric--balance {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.stu-services {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.stu-services li {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  max-width: 100%;
  font-size: 0.86rem;
  color: var(--site-muted, var(--ink-soft));
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(26, 107, 181, 0.04);
}

.stu-services li > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stu-services__price {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  white-space: nowrap;
  flex-shrink: 0;
}

.stu-balance {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-top: 0.15rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(26, 107, 181, 0.1), rgba(240, 192, 32, 0.12));
  border: 1px solid rgba(26, 107, 181, 0.18);
  width: auto;
  max-width: 100%;
}

.stu-balance__label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  white-space: nowrap;
}

.stu-balance__value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--site-blue, #1a6bb5);
  line-height: 1.1;
  white-space: nowrap;
}

.stu-balance__value.is-neg {
  color: var(--danger, #b42318);
}

.stu-empty {
  margin: 0;
  color: var(--site-muted, var(--ink-soft));
  font-size: 0.92rem;
}

.stu-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.75rem 1rem;
  min-height: 7rem;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.const-modal--wide .stu-card__body > .stu-loading,
.stu-zapis-grid-host > .stu-loading {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.stu-loading__spin {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--amber, #e8a317) 22%, transparent);
  border-top-color: var(--amber, #e8a317);
  animation: stu-spin 0.75s linear infinite;
}

.stu-loading__text {
  margin: 0;
  color: var(--site-muted, var(--ink-soft));
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: stu-loading-pulse 1.35s ease-in-out infinite;
}

@keyframes stu-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes stu-loading-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stu-loading__spin {
    animation: none;
    border-top-color: var(--amber, #e8a317);
    opacity: 0.85;
  }

  .stu-loading__text {
    animation: none;
    opacity: 0.85;
  }
}

@media (max-width: 640px) {
  .stu-card__head {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .stu-card__heading {
    min-width: 0;
  }

  .stu-card__name {
    font-size: 1.1rem;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .stu-card__balance {
    max-width: 46%;
    padding: 0.4rem 0.55rem;
  }

  .stu-card__balance-value {
    font-size: 1rem;
  }
}

.stu-docs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
}

.stu-docs > .stu-card {
  width: 100%;
}

.stu-docs__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--site-ink, var(--ink));
}

.stu-docs__lead {
  margin: 0;
  color: var(--site-muted, var(--ink-soft));
  font-size: 0.9rem;
}

.stu-card__body--docs {
  align-items: flex-start;
  gap: 0.75rem;
}

.stu-docs-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.stu-docs-group__title {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--site-blue, #1a6bb5);
}

.stu-doc {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--site-line, var(--line));
  border-radius: 12px;
  background: #fafbfc;
  padding: 0.7rem 0.85rem;
  box-sizing: border-box;
}

.stu-doc--mark {
  background: #fff;
}

.stu-doc__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.45rem;
}

.stu-doc__name {
  margin: 0;
  font-weight: 600;
  color: var(--site-ink, var(--ink));
  flex: 1 1 auto;
  min-width: 0;
}

.stu-doc__type {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--site-muted, var(--ink-soft));
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(26, 107, 181, 0.08);
  border: 1px solid rgba(26, 107, 181, 0.14);
}

.stu-doc__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-start;
}

.stu-doc__fact {
  background: #fff;
  border: 1px solid var(--site-line, var(--line));
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  min-width: 5.5rem;
}

.stu-doc__fact-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--site-muted, var(--ink-soft));
  margin-bottom: 0.15rem;
}

.stu-doc__fact-value {
  font-size: 0.86rem;
  color: var(--site-ink, var(--ink));
  white-space: nowrap;
}

.stu-exam-source {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.stu-exam-source__ico {
  display: inline-flex;
  line-height: 0;
}

.stu-exam-source__ico svg {
  width: 12px;
  height: 12px;
}

.stu-exam-actions {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stu-trenaj-nav {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.stu-trenaj-nav__row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
}

.stu-trenaj-nav .btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
}

.stu-exam-actions .btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
}

/* Таблицацы (как в React-эталоне data-table) */
.table-wrap {
  width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--site-line, var(--line));
  border-radius: var(--radius);
  overflow: auto;
}

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

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--site-line, var(--line));
  vertical-align: middle;
}

.data-table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--site-muted, var(--ink-soft));
  background: #e7ebf0;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: rgba(74, 107, 132, 0.06);
}

.data-table tbody tr.stu-row-pick {
  cursor: pointer;
}

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

.stu-grafik__wrap,
.stu-sheet__wrap {
  margin-top: 0.15rem;
  align-self: stretch;
  background: #fff;
  border-color: var(--site-line, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.stu-grafik__table,
.stu-sheet {
  font-size: 0.88rem;
  color: var(--site-ink, var(--ink));
  border-collapse: separate;
  border-spacing: 0;
}

.stu-grafik__table thead th,
.stu-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #eef2f6 0%, #e4e9ef 100%);
  border-bottom: 2px solid var(--line);
  color: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(18, 22, 28, 0.04);
}

.stu-grafik__table tbody td,
.stu-sheet tbody td {
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0.72rem 0.9rem;
}

.stu-grafik__table tbody tr:nth-child(even) td,
.stu-sheet tbody tr:nth-child(even) td {
  background: #f4f6f8;
}

.stu-grafik__table tbody tr:hover td,
.stu-sheet tbody tr:hover td {
  background: rgba(212, 160, 23, 0.1);
}

.stu-grafik__table tbody tr:hover td:first-child,
.stu-sheet tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--amber);
}

.stu-grafik__table tbody tr:last-child td,
.stu-sheet tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}

.stu-sheet td.stu-sheet__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stu-sheet__when {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
}

.stu-sheet__sub {
  margin-top: 0.12rem;
  font-size: 0.78rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-sheet td.stu-sheet__wrap,
.stu-sheet--docs td:nth-child(1) {
  white-space: normal;
  min-width: 8rem;
  max-width: 16rem;
}

.stu-sheet tbody tr.stu-sheet__prog td,
.stu-sheet tbody tr.stu-sheet__prog:hover td,
.stu-sheet tbody tr.stu-sheet__prog:nth-child(even) td {
  background: #e4e9ef;
  color: var(--site-ink, var(--ink));
  font-weight: 600;
  white-space: normal;
  box-shadow: none;
  border-bottom: 1px solid var(--line);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.stu-sheet tbody tr.stu-sheet__prog:hover td:first-child {
  box-shadow: none;
}

.stu-sheet tbody tr.stu-sheet__row--link {
  cursor: pointer;
}

.stu-sheet tbody tr.stu-sheet__row--link:focus {
  outline: 2px solid rgba(212, 160, 23, 0.55);
  outline-offset: -2px;
}

.stu-sheet tbody tr.stu-sheet__sum td,
.stu-sheet tbody tr.stu-sheet__sum:hover td,
.stu-sheet tbody tr.stu-sheet__sum:nth-child(even) td {
  background: #f4f6f8;
  font-weight: 600;
  box-shadow: none;
}

.stu-sheet tbody tr.stu-sheet__sum:hover td:first-child {
  box-shadow: none;
}

.stu-sheet tbody tr.stu-sheet__total td,
.stu-sheet tbody tr.stu-sheet__total:hover td,
.stu-sheet tbody tr.stu-sheet__total:nth-child(even) td {
  background: #e4e9ef;
  font-weight: 700;
  box-shadow: none;
  border-top: 2px solid var(--line);
}

.stu-sheet tbody tr.stu-sheet__total:hover td:first-child {
  box-shadow: none;
}

.stu-sheet td.stu-sheet__paid {
  color: var(--ok, #1f7a4c);
}

.stu-sheet td.stu-sheet__debt {
  color: var(--danger, #b42318);
}

.stu-sheet td.stu-sheet__debt.is-zero {
  color: var(--site-muted, var(--ink-soft));
}

.stu-sheet td.stu-sheet__muted {
  color: var(--site-muted, var(--ink-soft));
  text-align: center;
}

.stu-sheet .stu-sheet__pay {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 160, 23, 0.45);
  background: rgba(212, 160, 23, 0.12);
  color: var(--amber-deep, #a67c00);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.stu-sheet .stu-sheet__pay:hover {
  background: rgba(212, 160, 23, 0.22);
  text-decoration: none;
}

.stu-sheet td.stu-sheet__pay-cell {
  text-align: center;
  white-space: nowrap;
}

.stu-sheet tbody tr.stu-sheet__prog--toggle {
  cursor: pointer;
}

.stu-sheet__prog-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.stu-sheet__chevron {
  display: inline-block;
  width: 0.85em;
  color: var(--site-muted, var(--ink-soft));
  transition: transform 0.12s ease;
}

.stu-sheet tbody tr.stu-sheet__prog--toggle.is-open .stu-sheet__chevron {
  transform: rotate(90deg);
}

.stu-sheet--org-debt {
  min-width: 28rem;
}

.stu-sheet--org-debt th:nth-child(2),
.stu-sheet--org-debt th:nth-child(3),
.stu-sheet--org-debt th:nth-child(4),
.stu-sheet--org-debt th:nth-child(5) {
  text-align: right;
}

.stu-sheet--org-debt th:nth-child(5) {
  text-align: center;
}

.stu-sheet--org-debt td.stu-sheet__svc-name {
  padding-left: 1.35rem;
  font-weight: 400;
  color: var(--site-ink, var(--ink));
}

.stu-sheet--org-debt tbody tr.stu-sheet__svc td {
  background: #fafbfc;
}

.stu-sheet--org-debt tbody tr.stu-sheet__svc:nth-child(even) td {
  background: #f5f7f9;
}

.stu-sheet--org-debt tbody tr.stu-sheet__prog td.stu-sheet__num {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance td {
  background: #1c2430;
  color: #eef1f4;
  border-top: none;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance:hover td,
.stu-sheet--org-debt tbody tr.stu-sheet__total--balance:nth-child(even) td {
  background: #1c2430;
  color: #eef1f4;
}

/* Жёлтая полоска слева на hover сдвигала строку «Итого» — отключаем. */
.stu-sheet--org-debt tbody tr.stu-sheet__total--balance:hover td:first-child,
.stu-sheet--org-debt tbody tr.stu-sheet__total--balance td:first-child {
  box-shadow: none;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance .stu-sheet__pay {
  border-color: rgba(212, 160, 23, 0.65);
  background: rgba(212, 160, 23, 0.22);
  color: #f0d78a;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance .stu-sheet__pay:hover {
  background: rgba(212, 160, 23, 0.38);
  color: #fff;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance .stu-num.is-neg {
  color: #f5a8a0;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance .stu-num.is-pos {
  color: #8fd4ad;
}

.stu-sheet--org-debt tbody tr.stu-sheet__total--balance .stu-num.is-zero {
  color: #c5ccd4;
}

.stu-grafik__table td:nth-child(2) {
  white-space: normal;
  min-width: 10rem;
  max-width: 18rem;
}

.stu-grafik__table th:nth-child(6),
.stu-grafik__table td:nth-child(6),
.stu-grafik__table th:nth-child(7),
.stu-grafik__table td:nth-child(7) {
  text-align: center;
}

.stu-grafik__table td:nth-child(7) .btn {
  margin-left: auto;
  margin-right: auto;
}

.stu-grafik__when {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
}

.stu-grafik__when--soon {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  color: var(--asphalt, #1c2430);
  background: linear-gradient(135deg, #f0c020, #d4a017);
  border: 1px solid rgba(180, 132, 12, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.stu-grafik__soon-tag {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: rgba(28, 36, 48, 0.72);
}

.stu-grafik__when-date {
  display: block;
  line-height: 1.25;
}

.stu-grafik__table tbody tr.stu-grafik__row--soon td {
  background: rgba(212, 160, 23, 0.12) !important;
}

.stu-grafik__table tbody tr.stu-grafik__row--soon:hover td {
  background: rgba(212, 160, 23, 0.18) !important;
}

.stu-grafik__table tbody tr.stu-grafik__row--soon td:first-child {
  box-shadow: inset 4px 0 0 var(--amber);
}

.stu-grafik__sub {
  margin-top: 0.12rem;
  font-size: 0.78rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-grafik__rate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
}

.stu-grafik__stars {
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: block;
  text-align: center;
}

.stu-grafik__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  flex-shrink: 0;
}

.stu-grafik__status svg {
  width: 14px;
  height: 14px;
}

.stu-grafik__status--ok {
  color: var(--ok);
  background: rgba(31, 122, 76, 0.12);
  border: 1px solid rgba(31, 122, 76, 0.28);
}

.stu-grafik__status--plan {
  color: var(--steel);
  background: rgba(74, 107, 132, 0.1);
  border: 1px solid rgba(74, 107, 132, 0.22);
}

.stu-grafik__status--cancel {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.1);
  border: 1px solid rgba(180, 35, 24, 0.24);
}

.stu-grafik__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.stu-grafik__actions .btn,
.stu-grafik__table .btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
}

.stu-foto-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.stu-foto-cell__name {
  min-width: 0;
  line-height: 1.25;
}

.stu-foto-circle-host:empty {
  display: none;
}

.stu-foto-circle {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--amber, #d4a017) 55%, #8a9aaa);
  background: color-mix(in srgb, var(--paper, #eef1f4) 70%, #cfd6de);
  overflow: hidden;
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.stu-foto-circle--ok {
  cursor: pointer;
  border-color: var(--amber, #d4a017);
}

.stu-foto-circle--pending {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--amber, #d4a017) 40%, #8a9aaa);
  background: transparent;
}

.stu-foto-circle--pending::after {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--amber, #e8a317) 25%, transparent);
  border-top-color: var(--amber, #e8a317);
  animation: stu-spin 0.75s linear infinite;
}

.stu-foto-circle--ok:hover {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber, #d4a017) 35%, transparent);
}

.stu-foto-circle:disabled {
  opacity: 1;
  cursor: default;
}

.stu-foto-circle__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stu-foto-circle__ph {
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-soft, #5a6570);
  line-height: 1;
}

.stu-zapis-chrome {
  position: relative;
  width: 100%;
}

.stu-zapis-chrome__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  flex: 0 0 auto;
}

.stu-zapis-chrome__toggle-svg {
  width: 1rem;
  height: 1rem;
}

.stu-zapis-chrome.is-compact .stu-zapis-chrome__toggle,
.const-modal.is-zapis-compact .stu-zapis-chrome__toggle {
  display: inline-flex;
}

.stu-zapis-chrome.is-compact .stu-zapis-chrome__panel {
  display: none;
}

/* Свёрнутая шапка не занимает место над сеткой: только зазор под заголовком. */
.const-modal.is-zapis-compact .stu-card__body {
  position: relative;
  padding-top: 0;
}

.const-modal.is-zapis-compact .stu-zapis-chrome {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  margin: 0;
  overflow: visible;
  z-index: 8;
}

.const-modal.is-zapis-compact .stu-zapis-grid-host {
  margin-top: 0;
}

.stu-zapis-chrome.is-compact.is-open .stu-zapis-chrome__panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: absolute;
  z-index: 8;
  left: 0;
  top: calc(100% + 0.3rem);
  width: min(36rem, calc(100vw - 2rem));
  max-width: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--site-panel, #fff);
  color: var(--site-ink, var(--ink));
  border: 1px solid var(--site-line, var(--line));
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.14);
}

.stu-zapis-chrome.is-compact.is-open .stu-zapis-lead,
.stu-zapis-chrome.is-compact.is-open .stu-zapis-nav {
  margin: 0;
}

.stu-zapis-lead {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.stu-zapis-lead__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.stu-zapis-lead__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  min-width: 0;
  line-height: 1.35;
}

.stu-zapis-lead__meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  min-width: 0;
  line-height: 1.35;
}

.stu-zapis-lead__switch-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.stu-zapis-lead__switch-btn {
  appearance: none;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.stu-zapis-lead__switch-btn:disabled {
  cursor: default;
}

.stu-zapis-lead__switch-btn:not(:disabled):hover .stu-zapis-lead__instr-label {
  color: var(--steel);
}

.stu-zapis-lead__instr-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 20rem);
  line-height: 1.35;
}

.stu-zapis-lead__graf-block {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.stu-zapis-lead__graf {
  min-width: 0;
}

.stu-zapis-lead__meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  min-width: 0;
  line-height: 1.35;
}

.stu-zapis-lead__sep {
  color: var(--ink-soft);
  opacity: 0.55;
  font-size: 0.82rem;
  line-height: 1;
  user-select: none;
}

.stu-zapis-lead__switch-tri:disabled {
  opacity: 0.45;
  cursor: default;
}

.stu-zapis-lead__switch-tri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.35rem;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--ink);
}

.stu-zapis-lead__switch-btn:disabled .stu-zapis-lead__switch-tri {
  opacity: 0.45;
}

.stu-zapis-lead__picker {
  min-width: 16rem;
  max-width: 22rem;
  left: 0;
  top: calc(100% + 0.25rem);
}

.stu-zapis-lead__prog {
  color: var(--ink-soft);
}

.stu-zapis-lead__fotos {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.stu-zapis-lead__fotos:empty {
  display: none;
}

.stu-zapis-lead .stu-docs__lead {
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.stu-zapis-lead .stu-foto-circle {
  width: 2.75rem;
  height: 2.75rem;
}

.stu-foto-lb {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(28, 36, 48, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.stu-foto-lb__inner {
  position: relative;
  max-width: min(92vw, 640px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.stu-foto-lb__img {
  max-width: 100%;
  max-height: min(78vh, 720px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  background: #111;
}

.stu-foto-lb__inner--pdf {
  max-width: min(94vw, 900px);
  width: 100%;
}

.stu-foto-lb__pdf {
  width: 100%;
  height: min(80vh, 720px);
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.stu-foto-lb__cap {
  margin: 0;
  color: #f2f4f7;
  font-size: 0.95rem;
  text-align: center;
}

.stu-foto-lb__close {
  color: #f2f4f7 !important;
  border-color: color-mix(in srgb, #fff 35%, transparent) !important;
}

/* Сетка самозаписи (как график вождения) */
.stu-zapis-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.65rem 0 0.5rem;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.stu-zapis-nav__back {
  flex-shrink: 0;
}

.stu-zapis-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.55rem;
  min-width: auto;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  flex-shrink: 0;
}

.stu-zapis-nav__refresh-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
}

.stu-zapis-nav__refresh-svg {
  width: 100%;
  height: 100%;
}

.stu-zapis-nav__months {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex: 0 1 auto;
  min-width: 0;
}

.stu-zapis-nav__label {
  min-width: auto;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
}

.stu-zapis-nav__label-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 9rem;
  justify-content: flex-start;
}

.stu-zapis-nav__month-btn {
  appearance: none;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.stu-zapis-nav__month-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.stu-zapis-nav__month-btn:not(:disabled):hover .stu-zapis-nav__label {
  color: var(--steel);
}

.stu-zapis-nav__month-tri {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  min-height: 1.85rem;
  padding: 0.2rem 0.35rem;
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--ink);
}

.stu-zapis-nav__tri {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  min-height: 1.65rem;
  padding: 0.25rem 0.4rem;
  font-size: 1.25rem;
  line-height: 1;
}

.stu-zapis-nav__tri:disabled {
  opacity: 0.45;
  cursor: default;
}

.stu-zapis-nav__picker {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  transform: none;
  z-index: 20;
  min-width: 11rem;
  max-height: 14rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.14);
  padding: 0.25rem;
}

.stu-zapis-nav__picker-item {
  display: block;
  width: 100%;
  appearance: none;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.stu-zapis-nav__picker-item:hover,
.stu-zapis-nav__picker-item.is-active {
  background: color-mix(in srgb, var(--amber, #d4a017) 18%, #fff);
}

.stu-zapis-nav__select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  font: inherit;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

.stu-zapis-nav__select:focus {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(74, 107, 132, 0.18);
}

.stu-zapis-grid-host {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stu-zapis-grid-wrap {
  overflow: auto;
  max-height: min(58vh, 520px);
  background: transparent;
  border: none;
}

.stu-zapis-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
}

.stu-zapis-grid th,
.stu-zapis-grid td {
  text-align: center;
  vertical-align: middle;
  padding: 0.15rem;
  white-space: nowrap;
  background: transparent;
  border-bottom: none;
}

.stu-zapis-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #e7ebf0;
  box-shadow: 0 1px 0 var(--site-line, var(--line));
  padding: 0.35rem 0.2rem;
}

.stu-zapis-grid th:first-child,
.stu-zapis-grid td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #f7f8fa;
  z-index: 2;
  width: 2.75rem;
  min-width: 2.75rem;
  max-width: 3.25rem;
  padding-left: 0.28rem;
  padding-right: 0.28rem;
  box-shadow: inset -1px 0 0 #d0d5db;
}

.stu-zapis-grid tbody tr:nth-child(even) td:first-child {
  background: #eef1f4;
}

.stu-zapis-grid thead th:first-child {
  z-index: 4;
  background: #f0f2f5;
  left: 0;
  top: 0;
  box-shadow:
    inset -1px 0 0 #d0d5db,
    0 1px 0 var(--site-line, var(--line));
}

.stu-zapis-grid__day {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.2rem 0.28rem !important;
}

.stu-zapis-grid__day-num {
  font-weight: 600;
  color: var(--ink);
}

.stu-zapis-grid__day-name {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.stu-zapis-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 2rem;
  height: 100%;
  box-sizing: border-box;
  padding: 0.2rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: #f3f5f7;
  font: inherit;
  font-size: 0.72rem;
  color: var(--ink-soft);
  cursor: default;
}

.const-modal--wide .stu-zapis-grid-wrap {
  max-height: none;
  height: 100%;
}

.const-modal--wide .stu-zapis-grid {
  height: 100%;
}

.const-modal--wide .stu-zapis-grid tbody tr {
  height: 1%;
}

.const-modal--wide .stu-zapis-grid td {
  height: 100%;
  padding: 0;
}

.const-modal--wide .stu-zapis-cell:not(.stu-zapis-cell--legend) {
  min-height: 2.4rem;
}

/* Сетка записи — цвета ячеек */
.stu-zapis-cell--free {
  background: #53f9c7;
  border-color: #2dd4a8;
  color: #0d4a3a;
  cursor: pointer;
  font-weight: 600;
}

.stu-zapis-cell--free:hover:not(:disabled) {
  background: #3ef0b8;
}

.stu-zapis-cell--busy {
  background: #f8b4ba;
  border-color: #e88a94;
  color: transparent;
}

.stu-zapis-cell--busy.stu-zapis-cell--legend {
  color: #6b1520;
  -webkit-text-fill-color: #6b1520;
}

.stu-zapis-cell--mine {
  background: #94dbcc;
  border-color: #6fc4b5;
  color: #1a5c4a;
  font-weight: 700;
}

.stu-zapis-cell--debt {
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.15rem 0.2rem 0.15rem 0.55rem;
  line-height: 1.1;
}

.stu-zapis-cell__kind {
  font-size: 0.62rem;
  order: 1;
  white-space: nowrap;
  line-height: 1.1;
  color: inherit;
  -webkit-text-fill-color: currentColor;
}

.stu-zapis-cell__debt-rail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.32rem;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(180deg, #ffe566 0%, #e8b010 100%);
  box-shadow: inset -0.5px 0 0 rgba(42, 42, 42, 0.22);
}

.stu-zapis-cell__debt {
  order: 2;
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  color: #5a4a0a;
  -webkit-text-fill-color: #5a4a0a;
  white-space: nowrap;
  text-align: center;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.stu-zapis-cell--mine:not(:disabled) {
  cursor: pointer;
}

.stu-zapis-cell--mine:hover:not(:disabled) {
  background: #7fd0c0;
}

/* Своя запись / другой график: disabled не должен «серить» цвета */
.stu-zapis-cell--mine:disabled,
.stu-zapis-cell--mine-other:disabled,
.stu-zapis-cell--locked:disabled {
  opacity: 1;
  color: inherit;
}

.stu-zapis-cell--locked,
.stu-zapis-cell--cancelable {
  position: relative;
  cursor: default;
}

/* Крестик/замок слева от текста; при узкой ячейке текст переносится под иконку */
.stu-zapis-cell--locked:not(.stu-zapis-cell--legend),
.stu-zapis-cell--cancelable:not(.stu-zapis-cell--legend) {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  column-gap: 0.2rem;
  row-gap: 0.05rem;
  padding: 0.15rem 0.2rem;
  line-height: 1.1;
}

.stu-zapis-cell--cancelable:not(:disabled) {
  cursor: pointer;
}

.stu-zapis-cell--locked:not(.stu-zapis-cell--legend) .stu-zapis-cell__lock,
.stu-zapis-cell--cancelable:not(.stu-zapis-cell--legend) .stu-zapis-cell__cancel {
  position: static;
  transform: none;
  flex: 0 0 auto;
  order: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #1a5c4a;
  z-index: 2;
  pointer-events: none;
}

.stu-zapis-cell--locked:not(.stu-zapis-cell--legend) .stu-zapis-cell__kind,
.stu-zapis-cell--cancelable:not(.stu-zapis-cell--legend) .stu-zapis-cell__kind {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
}

.stu-zapis-cell--locked:not(.stu-zapis-cell--legend) .stu-zapis-cell__debt,
.stu-zapis-cell--cancelable:not(.stu-zapis-cell--legend) .stu-zapis-cell__debt {
  order: 2;
  flex: 1 0 100%;
  text-align: center;
}

.stu-zapis-cell__lock-svg,
.stu-zapis-cell__cancel-svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.stu-zapis-cell--debt.stu-zapis-cell--locked:not(.stu-zapis-cell--legend),
.stu-zapis-cell--debt.stu-zapis-cell--cancelable:not(.stu-zapis-cell--legend) {
  padding-left: 0.55rem;
}

.stu-zapis-cell--legend.stu-zapis-cell--locked,
.stu-zapis-cell--legend.stu-zapis-cell--cancelable {
  position: relative;
  padding-left: 1.35rem;
  padding-right: 0.45rem;
}

.stu-zapis-legend__help {
  cursor: pointer;
  font: inherit;
  appearance: none;
}

.stu-zapis-legend__help:hover {
  filter: brightness(0.97);
}

.stu-zapis-cell--legend .stu-zapis-cell__lock,
.stu-zapis-cell--legend .stu-zapis-cell__cancel {
  position: absolute;
  top: 50%;
  left: 0.2rem;
  right: auto;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #1a5c4a;
  z-index: 2;
  pointer-events: none;
}

.stu-zapis-cell--legend .stu-zapis-cell__lock-svg,
.stu-zapis-cell--legend .stu-zapis-cell__cancel-svg {
  width: 1.05rem;
  height: 1.05rem;
}

.stu-zapis-cell--mine-other {
  /* как tip -1/-2 в Delphi: RGB(255,220,200) */
  background: #ffdcc8;
  border-color: #e0b8a0;
  border-style: dashed;
  color: #5d4037;
  font-weight: 700;
}

.stu-zapis-cell--off {
  /* выходной / стоп — clGray посветлее ($00D4D4D4) */
  background: #e4e4e4;
  border-color: #d0d0d0;
  color: transparent;
}

.stu-zapis-cell--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #7ec8f0;
  border-color: #4aadde;
  color: transparent;
  cursor: wait;
}

.stu-zapis-cell__spin {
  display: block;
  flex: 0 0 auto;
  width: 0.85rem;
  height: 0.85rem;
  margin: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, #ffffff 45%, transparent);
  border-top-color: #1a5c8a;
  animation: stu-spin 0.75s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .stu-zapis-cell__spin {
    animation: none;
    border-top-color: #1a5c8a;
    opacity: 0.85;
  }
}

.stu-zapis-cell--legend {
  display: inline-flex;
  width: auto;
  height: auto;
  min-height: 0;
  margin-right: 0.55rem;
  min-width: auto;
  padding: 0.1rem 0.45rem;
  /* Не var(--ink): в тёмной теме ink светлеет и текст на цветном фоне пропадает */
  color: #1a2430;
  -webkit-text-fill-color: currentColor;
  vertical-align: middle;
}

.stu-zapis-cell--legend.stu-zapis-cell--free {
  color: #0d4a3a;
  -webkit-text-fill-color: #0d4a3a;
}

.stu-zapis-cell--legend.stu-zapis-cell--mine {
  color: #1a5c4a;
  -webkit-text-fill-color: #1a5c4a;
}

.stu-zapis-cell--legend.stu-zapis-cell--mine-other {
  color: #5d4037;
  -webkit-text-fill-color: #5d4037;
}

.stu-zapis-cell--legend.stu-zapis-cell--off {
  color: #4a4a4a;
  -webkit-text-fill-color: #4a4a4a;
}

.stu-zapis-cell--legend.stu-zapis-cell--debt {
  position: relative;
  padding-left: 0.65rem;
}

.stu-zapis-cell--legend .stu-zapis-cell__debt-rail {
  width: 0.28rem;
}

.stu-zapis-legend {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}

.stu-zapis-instr-wrap {
  margin-top: 0.65rem;
  overflow: auto;
  max-height: min(55vh, 480px);
}

.stu-zapis-instr th,
.stu-zapis-instr td {
  vertical-align: middle;
}

.stu-zapis-instr__avail {
  text-align: center;
}

.stu-zapis-instr__num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stu-zapis-instr__act {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.stu-zapis-avail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  min-height: 1.7rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef1f4;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink-soft);
  cursor: default;
}

.stu-zapis-avail--on {
  background: rgba(212, 160, 23, 0.18);
  border-color: rgba(212, 160, 23, 0.5);
  color: var(--ink);
  font-weight: 600;
  cursor: default;
}

.stu-zapis-avail--on:hover:not(:disabled) {
  background: rgba(212, 160, 23, 0.18);
}

.stu-zapis-avail--off {
  color: transparent;
  border-color: transparent;
  background: transparent;
}

.stu-zapis-avail--dim {
  background: rgba(28, 36, 48, 0.06);
  border-color: var(--line);
  color: var(--ink-soft);
  font-size: 0.72rem;
  cursor: default;
}

.stu-zapis-avail--legend {
  margin: 0 0.25rem;
  min-width: auto;
  color: var(--ink) !important;
}

/* Вложения обращений — превью как «чипы» с загрузкой */
.stu-ticket-create {
  position: relative;
}

.stu-ticket-create__picker {
  right: 0;
  left: auto;
  min-width: 16rem;
  max-width: min(22rem, 92vw);
  max-height: 18rem;
  z-index: 40;
}

.stu-ticket-create__hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-ticket-create__loading,
.stu-ticket-create__empty {
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-attach {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.35rem 0 0.85rem;
}

.stu-attach__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--site-muted, var(--ink-soft));
}

.stu-attach__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.stu-attach__card {
  position: relative;
  width: 5.1rem;
  border: 1px solid var(--site-line, var(--line));
  border-radius: 10px;
  background: var(--site-panel, #fff);
  box-shadow: 0 3px 10px rgba(36, 48, 56, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stu-attach__card.is-uploading {
  border-color: color-mix(in srgb, var(--amber, #d4a017) 55%, var(--line));
}

.stu-attach__card.is-error {
  border-color: #c45c5c;
}

.stu-attach__preview {
  position: relative;
  height: 3.75rem;
  background: #eef1f4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stu-attach__preview.is-clickable {
  cursor: zoom-in;
}

.stu-attach__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stu-attach__preview--pdf {
  background: #f7f8fa;
}

.stu-attach__pdf-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  background: #fff;
}

.stu-attach__pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c2430;
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stu-attach__pdf-badge {
  position: absolute;
  left: 0.25rem;
  bottom: 0.25rem;
  z-index: 2;
  background: var(--amber, #d4a017);
  color: #1c2430;
  border-radius: 4px;
  padding: 0.1rem 0.28rem;
  font-size: 0.62rem;
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  pointer-events: none;
}

.stu-attach__pdf .stu-attach__pdf-badge {
  position: static;
}

.stu-attach__del {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  z-index: 4;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(28, 36, 48, 0.55);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.stu-attach__card:hover .stu-attach__del,
.stu-attach__card:focus-within .stu-attach__del,
.stu-attach__card.is-uploading .stu-attach__del {
  opacity: 1;
}

@media (hover: none) {
  .stu-attach__del {
    opacity: 0.92;
  }
}

.stu-attach__del:hover {
  background: rgba(28, 36, 48, 0.82);
}

.stu-attach__del:disabled {
  opacity: 0.4;
  cursor: default;
}

.stu-attach__overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 48, 0.48);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  z-index: 2;
}

.stu-attach__queue-num {
  font-family: var(--font-display, "Barlow Condensed", sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.stu-attach__overlay .stu-loading__spin {
  width: 1.05rem;
  height: 1.05rem;
  border-width: 2px;
}

.stu-attach__name {
  margin: 0;
  padding: 0.28rem 0.35rem 0.35rem;
  font-size: 0.65rem;
  line-height: 1.2;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stu-attach__add {
  width: 5.1rem;
  min-height: 5.5rem;
  border: 1.5px dashed color-mix(in srgb, var(--amber, #d4a017) 55%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--amber, #d4a017) 8%, #fff);
  color: #1c2430;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.72rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.stu-attach__add:hover {
  background: color-mix(in srgb, var(--amber, #d4a017) 16%, #fff);
  border-color: var(--amber, #d4a017);
}

.stu-attach__add-plus {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--amber, #d4a017);
  font-weight: 700;
}

/* 404 / error page (тот же login-scene) */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.error-page__code {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.5rem, 12vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.error-page__title {
  margin-top: 0.35rem !important;
  font-size: clamp(1.75rem, 4.5vw, 2.4rem) !important;
}

.error-page__actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

/* Ширина окна: до 1100px меню не съедает контент. Шире — прежняя колонка слева. */
@media (max-width: 1100px) {
  .page-cabinet .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
    padding: 0.5rem 0.75rem;
  }

  .page-cabinet .topbar__brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-cabinet .topbar__brand .brand-name {
    font-size: clamp(1rem, 2.4vw, 1.15rem);
  }

  .page-cabinet .topbar__user {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem 0.5rem;
  }

  .user-meta {
    min-width: 0;
    max-width: 100%;
  }

  .user-meta strong,
  .user-meta span {
    display: block;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
  }

  .page-cabinet {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .cabinet-body {
    flex-direction: row;
    overflow: visible;
  }

  .page-cabinet:not(.is-nav-closed) .side-nav-backdrop {
    display: block;
    position: fixed;
    z-index: 170;
    top: var(--cabinet-topbar-h, 4.5rem);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 36, 48, 0.28);
  }

  .side-nav-slot {
    position: fixed;
    z-index: 180;
    top: var(--cabinet-topbar-h, 4.5rem);
    left: 0;
    bottom: 0;
    flex: none;
    box-shadow: 0 8px 28px rgba(18, 22, 28, 0.12);
  }

  .page-cabinet.is-nav-closed .side-nav-slot {
    box-shadow: none;
  }

  .cabinet-body > .workspace {
    padding: 0.75rem clamp(0.65rem, 2vw, 1.25rem) 1.25rem;
    overflow: visible;
  }

  .panel {
    padding: 0.85rem clamp(0.7rem, 2vw, 1.15rem);
    min-height: 0;
  }

  .stu-profile,
  .stu-card,
  .stu-docs,
  .stu-training {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .stu-card__name,
  .stu-card__sub,
  .panel h2 {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .stu-sheet__wrap,
  .stu-grafik__wrap,
  .table-wrap,
  .stu-metrics-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .stu-userdoc__fields {
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .const-modal {
    width: min(920px, calc(100vw - 1.25rem));
    max-height: calc(100dvh - 1.25rem);
  }

  .const-modal--wide {
    left: 0.5rem;
    right: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    max-width: none;
    max-height: none;
  }

  .const-modal__head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .const-modal__head h2 {
    overflow-wrap: break-word;
    min-width: 0;
  }

  .stu-confirm-modal,
  .widget-picker {
    width: min(480px, calc(100vw - 1.25rem));
    min-width: 0;
    max-width: calc(100vw - 1.25rem);
  }

  .stu-zapis-nav,
  .stu-zapis-nav__months,
  .stu-zapis-lead__row {
    flex-wrap: wrap;
  }

  .stu-zapis-grid-wrap {
    overflow: auto;
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .page-cabinet .topbar__user {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .user-meta {
    max-width: min(100%, 14rem);
    text-align: left;
  }

  .profile-pop {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    top: 6.5rem;
    /* JS пересчитает max-height от фактического top */
    max-height: calc(100vh - 7.25rem);
    max-height: calc(100dvh - 7.25rem);
  }

  .stu-card__head {
    padding: 0.75rem 0.8rem 0.65rem;
    gap: 0.55rem;
  }

  .stu-card__body {
    padding: 0.75rem 0.8rem 0.85rem;
  }
}

.h-scroll {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.stu-zapis-grid-host > .h-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.h-scroll.can-left::before,
.h-scroll.can-right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2rem;
  pointer-events: none;
  z-index: 2;
}

.h-scroll.can-left::before {
  left: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(to right, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

.h-scroll.can-right::after {
  right: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
}

.h-scroll__btn {
  display: none;
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--site-line, #e2e7ec);
  border-radius: 999px;
  background: #fff;
  color: var(--site-blue, #1a6bb5);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(18, 22, 28, 0.12);
  align-items: center;
  justify-content: center;
}

.h-scroll.can-left .h-scroll__btn--left,
.h-scroll.can-right .h-scroll__btn--right {
  display: inline-flex;
}

.h-scroll__btn--left {
  left: 0.35rem;
}

.h-scroll__btn--right {
  right: 0.35rem;
}

.h-scroll__btn svg {
  display: block;
}

.h-scroll__btn:hover {
  border-color: var(--site-blue, #1a6bb5);
  background: rgba(26, 107, 181, 0.06);
}

/* Настройки: раздел (есть дочки) и конечная настройка */
.stu-set__group {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--site-ink, var(--ink));
}

.stu-set__body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.15rem 1.15rem;
}

.stu-set__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.stu-set__name {
  font-weight: 600;
  color: var(--site-ink, var(--ink));
}

.stu-set__val {
  color: var(--site-muted, var(--ink-soft));
}

.stu-set__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stu-set__opt {
  margin: 0;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--site-line, var(--line));
  border-radius: 8px;
  background: transparent;
  color: var(--site-ink, var(--ink));
  font-family: var(--font-body);
  font-size: 0.86rem;
  cursor: pointer;
}

.stu-set__opt:hover:not(:disabled) {
  border-color: var(--site-blue, #1a6bb5);
  color: var(--site-blue, #1a6bb5);
}

.stu-set__opt.is-on {
  background: rgba(26, 107, 181, 0.1);
  border-color: var(--site-blue, #1a6bb5);
  color: var(--site-blue, #1a6bb5);
  font-weight: 600;
}

.stu-set__opt:disabled {
  cursor: default;
}

/* Стиль сайта: светлая — как сейчас. Тёмная инвертирует панели, таблицы и модалки. */
html[data-theme="dark"] .page-cabinet {
  --site-ink: #e6ebf0;
  --site-muted: #9aa6b2;
  --site-line: #3c4858;
  --site-bg: #141a22;
  --site-panel: #1e2833;
  --site-blue: #8eb6de;
  --ink: #e6ebf0;
  --ink-soft: #9aa6b2;
  --paper: #141a22;
  --paper-2: #1e2833;
  --line: #3c4858;
  color-scheme: dark;
}

html[data-theme="gray"] .page-cabinet {
  --site-ink: #2c3238;
  --site-muted: #5e6770;
  --site-line: #b7bcc2;
  --site-bg: #cfd3d8;
  --site-panel: #e4e7eb;
  --site-blue: #3f6484;
  --site-yellow: #b7a67a;
  --site-red: #9a5c58;
  --ink: #2c3238;
  --ink-soft: #5e6770;
  --paper: #cfd3d8;
  --paper-2: #e4e7eb;
  --line: #b7bcc2;
  color-scheme: light;
}

html[data-theme="dark"] {
  background: #141a22;
}

html[data-theme="gray"] {
  background: #cfd3d8;
}

html[data-theme="dark"] .page-cabinet .stu-card__head,
html[data-theme="gray"] .page-cabinet .stu-card__head,
html[data-theme="dark"] .page-cabinet .placeholder-box,
html[data-theme="dark"] .page-cabinet .side-nav__toggle,
html[data-theme="dark"] .page-cabinet .h-scroll__btn {
  background: var(--site-panel);
  color: var(--site-ink);
}

html[data-theme="dark"] .page-cabinet input,
html[data-theme="dark"] .page-cabinet select,
html[data-theme="dark"] .page-cabinet textarea {
  background: var(--site-bg);
  color: var(--site-ink);
  border-color: var(--site-line);
}

/* Тёмная и серая: таблицы, модалки и белые карточки берут цвет темы, не #fff. */
html[data-theme="dark"] .page-cabinet .const-modal,
html[data-theme="gray"] .page-cabinet .const-modal,
html[data-theme="dark"] .page-cabinet .const-modal__head,
html[data-theme="gray"] .page-cabinet .const-modal__head,
html[data-theme="dark"] .page-cabinet .widget-picker,
html[data-theme="gray"] .page-cabinet .widget-picker,
html[data-theme="dark"] .page-cabinet .profile-pop,
html[data-theme="gray"] .page-cabinet .profile-pop,
html[data-theme="dark"] .page-cabinet .table-wrap:not(.stu-zapis-grid-wrap),
html[data-theme="gray"] .page-cabinet .table-wrap:not(.stu-zapis-grid-wrap),
html[data-theme="dark"] .page-cabinet .stu-grafik__wrap,
html[data-theme="gray"] .page-cabinet .stu-grafik__wrap,
html[data-theme="dark"] .page-cabinet .stu-sheet__wrap,
html[data-theme="gray"] .page-cabinet .stu-sheet__wrap,
html[data-theme="dark"] .page-cabinet .stu-training-card__panel,
html[data-theme="gray"] .page-cabinet .stu-training-card__panel,
html[data-theme="dark"] .page-cabinet .stu-chip,
html[data-theme="gray"] .page-cabinet .stu-chip,
html[data-theme="dark"] .page-cabinet .stu-metric,
html[data-theme="gray"] .page-cabinet .stu-metric,
html[data-theme="dark"] .page-cabinet .stu-doc--mark,
html[data-theme="gray"] .page-cabinet .stu-doc--mark,
html[data-theme="dark"] .page-cabinet .stu-doc__fact,
html[data-theme="gray"] .page-cabinet .stu-doc__fact,
html[data-theme="dark"] .page-cabinet .btn.toolbar-btn,
html[data-theme="gray"] .page-cabinet .btn.toolbar-btn,
html[data-theme="dark"] .page-cabinet .stu-zapis-nav__picker,
html[data-theme="gray"] .page-cabinet .stu-zapis-nav__picker,
html[data-theme="dark"] .page-cabinet .stu-zapis-chrome.is-compact.is-open .stu-zapis-chrome__panel,
html[data-theme="gray"] .page-cabinet .stu-zapis-chrome.is-compact.is-open .stu-zapis-chrome__panel,
html[data-theme="dark"] .page-cabinet .notes-area,
html[data-theme="gray"] .page-cabinet .notes-area,
html[data-theme="dark"] .page-cabinet .widget-tab,
html[data-theme="gray"] .page-cabinet .widget-tab,
html[data-theme="dark"] .page-cabinet .widget-period__date,
html[data-theme="gray"] .page-cabinet .widget-period__date {
  background: var(--site-panel);
  color: var(--site-ink);
  border-color: var(--site-line);
}

html[data-theme="dark"] .page-cabinet .widget-picker-overlay {
  background: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .page-cabinet .data-table th,
html[data-theme="dark"] .page-cabinet .stu-grafik__table thead th,
html[data-theme="dark"] .page-cabinet .stu-sheet thead th {
  background: #283444;
  color: var(--site-muted);
  border-color: var(--site-line);
  box-shadow: none;
}

html[data-theme="gray"] .page-cabinet .data-table th,
html[data-theme="gray"] .page-cabinet .stu-grafik__table thead th,
html[data-theme="gray"] .page-cabinet .stu-sheet thead th {
  background: #d5d9de;
  color: var(--site-muted);
  border-color: var(--site-line);
}

html[data-theme="dark"] .page-cabinet .data-table td,
html[data-theme="dark"] .page-cabinet .stu-grafik__table tbody td,
html[data-theme="dark"] .page-cabinet .stu-sheet tbody td,
html[data-theme="dark"] .page-cabinet .const-table th,
html[data-theme="dark"] .page-cabinet .const-table td {
  background: var(--site-panel);
  color: var(--site-ink);
  border-color: var(--site-line);
}

html[data-theme="gray"] .page-cabinet .data-table td,
html[data-theme="gray"] .page-cabinet .stu-grafik__table tbody td,
html[data-theme="gray"] .page-cabinet .stu-sheet tbody td {
  background: var(--site-panel);
  color: var(--site-ink);
  border-color: var(--site-line);
}

/* График записи: только подложка под цветными ячейками светлая; даты/время — как тема */
html[data-theme="dark"] .page-cabinet .stu-zapis-grid thead th,
html[data-theme="gray"] .page-cabinet .stu-zapis-grid thead th {
  background: #283444;
  color: var(--site-muted);
  border-color: var(--site-line);
  box-shadow: none;
}

html[data-theme="gray"] .page-cabinet .stu-zapis-grid thead th {
  background: #d5d9de;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-grid th:first-child,
html[data-theme="dark"] .page-cabinet .stu-zapis-grid td:first-child,
html[data-theme="gray"] .page-cabinet .stu-zapis-grid th:first-child,
html[data-theme="gray"] .page-cabinet .stu-zapis-grid td:first-child {
  background: var(--site-panel);
  color: var(--site-ink);
  border-color: var(--site-line);
  box-shadow: inset -1px 0 0 var(--site-line);
}

html[data-theme="dark"] .page-cabinet .stu-zapis-grid thead th:first-child,
html[data-theme="gray"] .page-cabinet .stu-zapis-grid thead th:first-child {
  background: #283444;
  color: var(--site-muted);
}

html[data-theme="gray"] .page-cabinet .stu-zapis-grid thead th:first-child {
  background: #d5d9de;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-grid tbody td:not(:first-child),
html[data-theme="gray"] .page-cabinet .stu-zapis-grid tbody td:not(:first-child) {
  background: #f7f8fa !important;
  border-color: #c9d0d8;
}

html[data-theme="dark"] .page-cabinet .stu-grafik__table tbody tr:nth-child(even) td,
html[data-theme="dark"] .page-cabinet .stu-sheet tbody tr:nth-child(even) td,
html[data-theme="dark"] .page-cabinet .data-table tbody tr:nth-child(even) {
  background: #182028;
}

html[data-theme="gray"] .page-cabinet .stu-grafik__table tbody tr:nth-child(even) td,
html[data-theme="gray"] .page-cabinet .stu-sheet tbody tr:nth-child(even) td {
  background: #d8dce1;
}

html[data-theme="dark"] .page-cabinet .data-table tbody tr:hover,
html[data-theme="dark"] .page-cabinet .stu-grafik__table tbody tr:hover td,
html[data-theme="dark"] .page-cabinet .stu-sheet tbody tr:hover td {
  background: rgba(142, 182, 222, 0.14);
}

html[data-theme="dark"] .page-cabinet .stu-grafik__table tbody tr.stu-grafik__row--soon td {
  background: rgba(212, 160, 23, 0.16) !important;
}

html[data-theme="dark"] .page-cabinet .stu-grafik__table tbody tr.stu-grafik__row--soon:hover td {
  background: rgba(212, 160, 23, 0.24) !important;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-nav__select,
html[data-theme="gray"] .page-cabinet .stu-zapis-nav__select,
html[data-theme="dark"] .page-cabinet .field input,
html[data-theme="dark"] .page-cabinet .field select,
html[data-theme="gray"] .page-cabinet .field input,
html[data-theme="gray"] .page-cabinet .field select {
  background: var(--site-bg);
  color: var(--site-ink);
  border-color: var(--site-line);
}

html[data-theme="dark"] .page-cabinet .const-modal h2,
html[data-theme="dark"] .page-cabinet .const-modal__head h2,
html[data-theme="gray"] .page-cabinet .const-modal h2,
html[data-theme="gray"] .page-cabinet .const-modal__head h2 {
  color: var(--site-ink);
}

/*
 * График записи: цветные ячейки остаются как в светлой теме.
 * color-scheme:dark на кабинете красит button в светлый текст — сбрасываем.
 */
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--free,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--free,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine-other,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine-other,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--busy,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--busy,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--off,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--off {
  color-scheme: light;
  -webkit-text-fill-color: currentColor;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--free,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--free {
  background: #53f9c7 !important;
  border-color: #2dd4a8 !important;
  color: #0d4a3a !important;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine {
  background: #94dbcc !important;
  border-color: #6fc4b5 !important;
  color: #1a5c4a !important;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine-other,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine-other {
  background: #ffdcc8 !important;
  border-color: #e0b8a0 !important;
  color: #5d4037 !important;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--busy:not(.stu-zapis-cell--legend),
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--busy:not(.stu-zapis-cell--legend) {
  background: #f8b4ba !important;
  border-color: #e88a94 !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--busy.stu-zapis-cell--legend,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--busy.stu-zapis-cell--legend {
  background: #f8b4ba !important;
  border-color: #e88a94 !important;
  color: #6b1520 !important;
  -webkit-text-fill-color: #6b1520;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--off,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--off {
  background: #e4e4e4 !important;
  border-color: #d0d0d0 !important;
  color: #6a6a6a !important;
}

/* Легенда: тёмный текст на цветных чипах (не --ink светлой темы) */
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--free,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--free {
  color: #0d4a3a !important;
  -webkit-text-fill-color: #0d4a3a;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--mine,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--mine {
  color: #1a5c4a !important;
  -webkit-text-fill-color: #1a5c4a;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--mine-other,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--mine-other {
  color: #5d4037 !important;
  -webkit-text-fill-color: #5d4037;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--off,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--legend.stu-zapis-cell--off {
  color: #4a4a4a !important;
  -webkit-text-fill-color: #4a4a4a;
}

/* Баланс в шапке: на тёмной панели ярче красный/зелёный */
html[data-theme="dark"] .page-cabinet .topbar__balance-value.is-neg,
html[data-theme="dark"] .page-cabinet .stu-metric__value.is-neg,
html[data-theme="dark"] .page-cabinet .stu-card__balance-value.is-neg,
html[data-theme="dark"] .page-cabinet .stu-balance__value.is-neg {
  color: #ff8a80 !important;
}

html[data-theme="dark"] .page-cabinet .topbar__balance-value.is-pos,
html[data-theme="dark"] .page-cabinet .stu-metric__value.is-pos,
html[data-theme="dark"] .page-cabinet .stu-card__balance-value.is-pos,
html[data-theme="dark"] .page-cabinet .stu-balance__value.is-pos {
  color: #6dcca0 !important;
}

html[data-theme="dark"] .page-cabinet .topbar__balance-value.is-zero,
html[data-theme="dark"] .page-cabinet .stu-metric__value.is-zero {
  color: #8eb6de !important;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__kind,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__kind,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__lock,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__lock,
html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__cancel,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine .stu-zapis-cell__cancel {
  color: #1a5c4a !important;
  -webkit-text-fill-color: #1a5c4a;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell--mine-other .stu-zapis-cell__kind,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell--mine-other .stu-zapis-cell__kind {
  color: #5d4037 !important;
  -webkit-text-fill-color: #5d4037;
}

html[data-theme="dark"] .page-cabinet .stu-zapis-cell__debt,
html[data-theme="gray"] .page-cabinet .stu-zapis-cell__debt {
  color: #5a4a0a !important;
  -webkit-text-fill-color: #5a4a0a;
}


