/* ==========================================================================
   LMS-HRM · Material Design 3 — базовые стили и компоненты
   ========================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--md-sys-typescale-font);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  transition: background-color var(--md-sys-motion-duration-medium4)
              var(--md-sys-motion-easing-standard);
  overflow: hidden;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--md-sys-color-primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }

::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--md-sys-color-on-surface-variant) 30%, transparent);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in oklab, var(--md-sys-color-on-surface-variant) 55%, transparent); }

:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
  border-radius: var(--md-sys-shape-corner-small);
}

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

/* ==========================================================================
   Типографика
   ========================================================================== */
.t-display-large { font-size: var(--md-sys-typescale-display-large-size); line-height: var(--md-sys-typescale-display-large-line); font-weight: 700; letter-spacing: -0.02em; }
.t-display-medium { font-size: var(--md-sys-typescale-display-medium-size); line-height: var(--md-sys-typescale-display-medium-line); font-weight: 700; letter-spacing: -0.02em; }
.t-headline-large { font-size: var(--md-sys-typescale-headline-large-size); line-height: var(--md-sys-typescale-headline-large-line); font-weight: 700; letter-spacing: -0.015em; }
.t-headline-medium { font-size: var(--md-sys-typescale-headline-medium-size); line-height: var(--md-sys-typescale-headline-medium-line); font-weight: 650; letter-spacing: -0.01em; }
.t-headline-small { font-size: var(--md-sys-typescale-headline-small-size); line-height: var(--md-sys-typescale-headline-small-line); font-weight: 650; letter-spacing: -0.01em; }
.t-title-large { font-size: var(--md-sys-typescale-title-large-size); line-height: var(--md-sys-typescale-title-large-line); font-weight: 650; letter-spacing: -0.005em; }
.t-title-medium { font-size: var(--md-sys-typescale-title-medium-size); line-height: var(--md-sys-typescale-title-medium-line); font-weight: 600; }
.t-title-small { font-size: var(--md-sys-typescale-title-small-size); line-height: var(--md-sys-typescale-title-small-line); font-weight: 600; }
.t-body-large { font-size: var(--md-sys-typescale-body-large-size); line-height: var(--md-sys-typescale-body-large-line); }
.t-body-medium { font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line); }
.t-body-small { font-size: var(--md-sys-typescale-body-small-size); line-height: var(--md-sys-typescale-body-small-line); color: var(--md-sys-color-on-surface-variant); }
.t-label-large { font-size: var(--md-sys-typescale-label-large-size); line-height: var(--md-sys-typescale-label-large-line); font-weight: 600; letter-spacing: 0.01em; }
.t-label-medium { font-size: var(--md-sys-typescale-label-medium-size); line-height: var(--md-sys-typescale-label-medium-line); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.t-label-small { font-size: var(--md-sys-typescale-label-small-size); line-height: var(--md-sys-typescale-label-small-line); font-weight: 600; letter-spacing: 0.05em; }
.t-muted { color: var(--md-sys-color-on-surface-variant); }
.t-mono { font-family: var(--md-sys-typescale-font-mono); font-variant-numeric: tabular-nums; }
.t-num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   State layer + ripple
   ========================================================================== */
.state-layer { position: relative; isolation: isolate; overflow: hidden; }
.state-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  pointer-events: none;
  z-index: -1;
}
.state-layer:hover::after { opacity: 0.08; }
.state-layer:active::after { opacity: 0.12; }
.state-layer:focus-visible::after { opacity: 0.10; }

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: currentColor;
  opacity: 0.22;
  pointer-events: none;
  animation: ripple-expand 560ms var(--md-sys-motion-easing-standard) forwards;
}
@keyframes ripple-expand {
  to { transform: scale(2.6); opacity: 0; }
}

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  background: transparent;
  color: var(--md-sys-color-primary);
  transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.btn::after {
  content: "";
  position: absolute; inset: 0;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.btn:hover::after { opacity: 0.08; }
.btn:active::after { opacity: 0.12; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; pointer-events: none; }

.btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn--elevated { background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-primary); box-shadow: var(--md-sys-elevation-1); }
.btn--elevated:hover { box-shadow: var(--md-sys-elevation-2); }
.btn--outlined { border: 1px solid var(--md-sys-color-outline); color: var(--md-sys-color-primary); }
.btn--outlined:hover { background: color-mix(in oklab, var(--md-sys-color-primary) 8%, transparent); }
.btn--text { padding: 0 12px; }
.btn--danger { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
.btn--danger-text { color: var(--md-sys-color-error); }
.btn--sm { height: 32px; padding: 0 16px; font-size: var(--md-sys-typescale-label-medium-size); }
.btn--lg { height: 52px; padding: 0 32px; font-size: 1rem; }
.btn--icon { width: 40px; padding: 0; border-radius: var(--md-sys-shape-corner-full); }
.btn--icon.btn--sm { width: 32px; }
.btn .icon { width: 18px; height: 18px; flex: none; }

.icon { width: 24px; height: 24px; flex: none; stroke-width: 2; }
.icon--sm { width: 18px; height: 18px; }
.icon--lg { width: 28px; height: 28px; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* FAB */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: var(--lms-z-fab);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px;
  border: none;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-3);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
              transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
              background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  animation: fab-in var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized-decelerate) both;
}
.fab:hover { box-shadow: var(--md-sys-elevation-4); transform: translateY(-2px); }
.fab:active { transform: translateY(0) scale(0.97); }
.fab::after {
  content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.fab:hover::after { opacity: 0.08; }
.fab .icon { width: 24px; height: 24px; }
@keyframes fab-in {
  from { opacity: 0; transform: translateY(24px) scale(0.85); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Иконки в круге / аватары
   ========================================================================== */
.icon-badge {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.icon-badge--lg { width: 48px; height: 48px; }
.icon-badge--sm { width: 32px; height: 32px; }
.icon-badge--primary { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.icon-badge--tertiary { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.icon-badge--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.icon-badge--success { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.icon-badge--warning { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.icon-badge--info { background: var(--md-sys-color-info-container); color: var(--md-sys-color-on-info-container); }
.icon-badge--outline { background: transparent; border: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); }

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(140deg,
    oklch(0.62 0.16 var(--hue, 285)) 0%,
    oklch(0.45 0.19 var(--hue, 285)) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  user-select: none;
}
.avatar--sm { width: 32px; height: 32px; font-size: 0.6875rem; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.0625rem; }
.avatar--xl { width: 84px; height: 84px; font-size: 1.625rem; }
/* Фото профиля: круглая обрезка и замещающий фон на время загрузки. */
.avatar--photo { background: oklch(0.90 0.02 var(--hue, 285)); overflow: hidden; box-shadow: none; }
.avatar--photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Загрузка фото профиля */
.photo-edit { align-items: center; }
.photo-edit__input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.photo-edit__preview {
  display: flex;
  border-radius: var(--md-sys-shape-corner-full);
  outline: 1px solid var(--md-sys-color-outline-variant);
  outline-offset: 2px;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--md-sys-color-surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ==========================================================================
   Карточки
   ========================================================================== */
.card {
  position: relative;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
  transition: box-shadow var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
.card--elevated { background: var(--md-sys-color-surface-container-low); box-shadow: var(--md-sys-elevation-1); }
.card--elevated:hover { box-shadow: var(--md-sys-elevation-3); }
.card--filled { background: var(--md-sys-color-surface-container-highest); }
.card--outlined { background: var(--md-sys-color-surface); border: 1px solid var(--md-sys-color-outline-variant); }
.card--interactive { cursor: pointer; }
.card--interactive:hover { transform: translateY(-3px); box-shadow: var(--md-sys-elevation-3); }
.card__pad { padding: 20px; }
.card__pad-lg { padding: 24px 24px 20px; }
.card__divider { height: 1px; background: var(--md-sys-color-outline-variant); opacity: .55; }

/* ==========================================================================
   Чипы / бейджи
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 600;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip--assist {
  border-color: var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.chip--assist:hover { background: color-mix(in oklab, var(--md-sys-color-on-surface) 8%, transparent); }
.chip--selected { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; }
.chip--primary { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.chip--tertiary { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.chip--success { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success-container); }
.chip--warning { background: var(--md-sys-color-warning-container); color: var(--md-sys-color-on-warning-container); }
.chip--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.chip--info { background: var(--md-sys-color-info-container); color: var(--md-sys-color-on-info-container); }
.chip--sm { height: 24px; padding: 0 8px; font-size: var(--md-sys-typescale-label-small-size); }
.chip .icon { width: 16px; height: 16px; }
.chip--clickable { cursor: pointer; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge-dot {
  min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: var(--md-sys-typescale-label-small-size);
  font-weight: 700;
}

/* ==========================================================================
   Индикаторы прогресса
   ========================================================================== */
.linear-progress {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: var(--md-sys-color-surface-container-highest);
  overflow: hidden;
}
.linear-progress--thick { height: 12px; }
.linear-progress--thin { height: 4px; }
.linear-progress__bar {
  position: absolute;
  inset-block: 0; left: 0;
  border-radius: 99px;
  background: var(--md-sys-color-primary);
  width: 0;
  transition: width var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized);
}
.linear-progress__bar--success { background: var(--md-sys-color-success); }
.linear-progress__bar--warning { background: var(--md-sys-color-warning); }
.linear-progress__bar--error { background: var(--md-sys-color-error); }
.linear-progress__bar--info { background: var(--md-sys-color-info); }
.linear-progress--indeterminate .linear-progress__bar {
  width: 40% !important;
  animation: lp-indeterminate 1.6s var(--md-sys-motion-easing-standard) infinite;
}
@keyframes lp-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.circular-progress { position: relative; display: inline-grid; place-items: center; }
.circular-progress svg { transform: rotate(-90deg); }
.circular-progress circle { fill: none; stroke-linecap: round; }
.circular-progress__track { stroke: var(--md-sys-color-surface-container-highest); }
.circular-progress__bar { stroke: var(--md-sys-color-primary); transition: stroke-dashoffset var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized); }
.circular-progress--success .circular-progress__bar { stroke: var(--md-sys-color-success); }
.circular-progress--warning .circular-progress__bar { stroke: var(--md-sys-color-warning); }
.circular-progress--error .circular-progress__bar { stroke: var(--md-sys-color-error); }
.circular-progress__label {
  position: absolute;
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Сегментная шкала просмотренных сегментов видео */
.segments { display: flex; gap: 2px; height: 8px; }
.segments__seg {
  flex: 1;
  border-radius: 2px;
  background: var(--md-sys-color-surface-container-highest);
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.segments__seg--watched { background: var(--md-sys-color-primary); }
.segments__seg--current { background: var(--md-sys-color-primary); animation: seg-pulse 1.4s ease-in-out infinite; }
@keyframes seg-pulse { 50% { opacity: .45; } }

/* ==========================================================================
   Поля ввода
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--md-sys-typescale-label-large-size); font-weight: 600; color: var(--md-sys-color-on-surface-variant); }
.field__hint { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }
.field__error { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-error); display: flex; align-items: center; gap: 4px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  transition: border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.input::placeholder, .textarea::placeholder { color: color-mix(in oklab, var(--md-sys-color-on-surface-variant) 75%, transparent); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--md-sys-color-on-surface-variant); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2372707f' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  cursor: pointer;
}

/* Filled text field (M3) */
.filled-field { position: relative; }
.filled-field .input {
  background: var(--md-sys-color-surface-container-high);
  border: none;
  border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small) 0 0;
  padding-top: 22px;
}
.filled-field .input:focus { background: var(--md-sys-color-surface-container-highest); box-shadow: none; }
.filled-field__label {
  position: absolute;
  left: 16px; top: 14px;
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.filled-field .input:focus + .filled-field__label,
.filled-field .input:not(:placeholder-shown) + .filled-field__label {
  transform: translateY(-10px) scale(0.72);
  color: var(--md-sys-color-primary);
}
.filled-field__bar {
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  background: var(--md-sys-color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
.filled-field .input:focus ~ .filled-field__bar { transform: scaleX(1); }

/* Переключатель */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch__track {
  position: relative;
  width: 52px; height: 32px;
  flex: none;
  border-radius: 99px;
  background: var(--md-sys-color-surface-container-highest);
  border: 2px solid var(--md-sys-color-outline);
  transition: background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              border-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}
.switch__thumb {
  position: absolute;
  top: 50%; left: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  transform: translateY(-50%);
  transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch input:checked + .switch__track { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
.switch input:checked + .switch__track .switch__thumb {
  left: 26px; width: 22px; height: 22px; background: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}
.switch input:focus-visible + .switch__track { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }

/* Чекбокс */
.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox input { position: absolute; opacity: 0; }
.checkbox__box {
  width: 20px; height: 20px; flex: none;
  border-radius: 3px;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  display: grid; place-items: center;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.checkbox__box svg { width: 14px; height: 14px; stroke: var(--md-sys-color-on-primary); stroke-width: 3; opacity: 0; transform: scale(.4); transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized); }
.checkbox input:checked + .checkbox__box { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
.checkbox input:checked + .checkbox__box svg { opacity: 1; transform: none; }
.checkbox input:focus-visible + .checkbox__box { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }
/* чекбокс в ячейке таблицы матрицы прав: без подписи и без курсора при блокировке */
.checkbox--bare { gap: 0; margin: 0; justify-content: center; }
.checkbox input:disabled + .checkbox__box { opacity: .38; cursor: not-allowed; }
.checkbox:has(input:disabled) { cursor: not-allowed; }

/* ==========================================================================
   Списки
   ========================================================================== */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  min-height: 56px;
  border-radius: var(--md-sys-shape-corner-medium);
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
}
.list-item--clickable { cursor: pointer; }
.list-item--clickable:hover { background: color-mix(in oklab, var(--md-sys-color-on-surface) 6%, transparent); }
.list-item__text { min-width: 0; flex: 1; }
.list-item__title { font-size: var(--md-sys-typescale-body-large-size); font-weight: 550; }
.list-item__sub { font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }
.list-item__trailing { display: flex; align-items: center; gap: 8px; flex: none; }

/* ==========================================================================
   Табы
   ========================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--md-sys-color-outline-variant); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 12px 18px 14px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-title-small-size);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.tab::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--md-sys-color-primary);
  transform: scaleX(0);
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
.tab:hover { color: var(--md-sys-color-on-surface); }
.tab--active { color: var(--md-sys-color-primary); }
.tab--active::after { transform: scaleX(1); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
}
.segmented__item {
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  padding: 7px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.segmented__item:hover { color: var(--md-sys-color-on-surface); }
.segmented__item--active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  box-shadow: var(--md-sys-elevation-1);
}

/* ==========================================================================
   Диалоги / меню / снекбар
   ========================================================================== */
.scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--md-sys-color-scrim) 40%, transparent);
  backdrop-filter: blur(3px);
  z-index: var(--lms-z-dialog);
  animation: fade-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: calc(var(--lms-z-dialog) + 1);
  width: min(640px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: var(--md-sys-elevation-5);
  animation: dialog-in var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized-decelerate) both;
  overflow: hidden;
}
.dialog--wide { width: min(920px, calc(100vw - 32px)); }
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.dialog__head { padding: 24px 24px 8px; display: flex; align-items: flex-start; gap: 16px; }
.dialog__body { padding: 8px 24px; overflow-y: auto; flex: 1; }
.dialog__foot {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.dialog__icon {
  width: 40px; height: 40px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.menu {
  position: fixed;
  z-index: calc(var(--lms-z-dialog) + 2);
  min-width: 208px;
  padding: 8px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-3);
  animation: menu-in var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate) both;
  transform-origin: top left;
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.menu__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-body-medium-size);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}
.menu__item:hover { background: color-mix(in oklab, var(--md-sys-color-on-surface) 8%, transparent); }
.menu__item--danger { color: var(--md-sys-color-error); }
.menu__sep { height: 1px; margin: 6px 8px; background: var(--md-sys-color-outline-variant); opacity: .5; }
.menu__label { padding: 8px 12px 4px; font-size: var(--md-sys-typescale-label-medium-size); color: var(--md-sys-color-on-surface-variant); }

.snackbar-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: var(--lms-z-snackbar);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.snackbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-3);
  font-size: var(--md-sys-typescale-body-medium-size);
  pointer-events: auto;
  animation: snack-in var(--md-sys-motion-duration-medium4) var(--md-sys-motion-easing-emphasized-decelerate) both;
}
.snackbar--out { animation: snack-out var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-accelerate) both; }
.snackbar__action { color: var(--md-sys-color-inverse-primary); font-weight: 700; background: none; border: none; cursor: pointer; margin-left: auto; }
@keyframes snack-in { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes snack-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }

/* Тултип */
.tooltip {
  position: fixed;
  z-index: calc(var(--lms-z-dialog) + 3);
  padding: 6px 10px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  font-size: var(--md-sys-typescale-label-small-size);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--md-sys-elevation-2);
  animation: fade-in 120ms var(--md-sys-motion-easing-standard) both;
}

/* ==========================================================================
   Утилиты
   ========================================================================== */
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.row--top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 12px; }
.col--tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

.grid { display: grid; gap: var(--lms-gap); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack--sm { gap: 12px; }
.stack--lg { gap: 28px; }

/* Появление */
.reveal { animation: reveal var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized-decelerate) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.skeleton {
  border-radius: var(--md-sys-shape-corner-medium);
  background: linear-gradient(90deg,
    var(--md-sys-color-surface-container) 25%,
    var(--md-sys-color-surface-container-high) 37%,
    var(--md-sys-color-surface-container) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

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