/* ============================================================
   Пицца Хаус — портал обучения персонала
   ------------------------------------------------------------
   Дизайн-токены собраны в :root. Меняются только там.
   Шкала отступов кратна 4 px — от неё считаются все поля,
   зазоры и радиусы, поэтому вёрстка держит единый ритм.
   ============================================================ */

:root {
  /* --- Отступы --- */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 20px;  --s6: 24px;  --s7: 32px;  --s8: 40px;
  --s9: 56px;  --s10: 72px;

  /* --- Радиусы --- */
  --r1: 8px;  --r2: 12px;  --r3: 16px;  --r4: 20px;  --r5: 28px;
  --pill: 999px;

  /* --- Фон и текст --- */
  --bg:        #f4efe4;
  --surface:   #ffffff;
  --surface-2: #faf6ee;
  --surface-3: #f0e9db;
  --ink:       #17150f;
  --ink-2:     #57503f;
  --ink-3:     #8d8474;
  --hairline:  #e6dcc8;
  --hairline-2:#f0e9db;

  /* --- Бренд --- */
  --green:      #124a29;
  --green-2:    #1b7a45;
  --green-soft: #e3efe7;
  --accent:     #d2451d;
  --accent-2:   #ae360f;
  --accent-soft:#fce9e0;

  /* --- Тона отделов и статусов --- */
  --gold:       #9a6a06;
  --gold-soft:  #faefd6;
  --blue:       #1b4a80;
  --blue-soft:  #e4edf7;
  --purple:     #563586;
  --purple-soft:#ece4f8;

  /* --- Типографика --- */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* --- Тени --- */
  --sh1: 0 1px 2px rgba(23, 21, 15, .05);
  --sh2: 0 2px 4px rgba(23, 21, 15, .04), 0 8px 20px rgba(23, 21, 15, .05);
  --sh3: 0 10px 24px rgba(23, 21, 15, .10), 0 30px 60px rgba(23, 21, 15, .12);

  /* --- Каркас --- */
  --sidebar-w: 276px;
  --pad:       var(--s6);
  --tabbar-h:  0px;
}

/* ============================================================
   База
   ============================================================ */

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }

.muted     { color: var(--ink-3); }
.muted-bad { color: var(--accent-2); font-weight: 700; }

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* ============================================================
   ЭКРАН ВХОДА
   ============================================================ */

.auth {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth__brand {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: var(--s7) var(--s6);
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(27, 122, 69, .55) 0%, rgba(18, 74, 41, 0) 60%),
    linear-gradient(160deg, #176034 0%, #0e3d22 100%);
  color: #fff;
}

.auth__logo {
  height: 38px;
  width: auto;
  filter: brightness(0) invert(1);
}

.auth__headline {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.025em;
}

.auth__lead {
  font-size: 15.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .82);
  max-width: 46ch;
}

.auth__points { display: grid; gap: var(--s3); }
.auth__points li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 14px;
  color: rgba(255, 255, 255, .92);
}
.auth__points .icon { color: #ffd58a; }

.auth__side {
  display: grid;
  place-items: center;
  padding: var(--s6) var(--s5) var(--s8);
  background: var(--bg);
}

.auth__card { width: min(420px, 100%); }

.auth__flag {
  display: flex;
  gap: var(--s3);
  padding: var(--s4);
  margin-bottom: var(--s6);
  border-radius: var(--r2);
  background: var(--accent-soft);
  border: 1px solid #f2d5c8;
  font-size: 13px;
  line-height: 1.5;
  color: var(--accent-2);
}
.auth__flag .icon { flex: none; width: 17px; height: 17px; margin-top: 1px; }
.auth__flag strong { font-weight: 800; }

.auth__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.auth__sub {
  margin-top: var(--s1);
  margin-bottom: var(--s6);
  font-size: 14px;
  color: var(--ink-3);
}

.auth__form { display: grid; gap: var(--s4); }
.auth__form .btn { margin-top: var(--s2); }

/* --- Выбор входа --- */

.rolepick { display: grid; gap: var(--s3); margin-top: var(--s6); }

.rolepick__btn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s5);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r3);
  background: var(--surface);
  text-align: left;
  transition: border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.rolepick__btn:hover {
  border-color: var(--green-2);
  box-shadow: var(--sh2);
  transform: translateY(-1px);
}
.rolepick__btn:active { transform: translateY(0); }

.rolepick__ic {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: var(--r2);
  background: var(--green-soft);
  color: var(--green);
}
.rolepick__text { display: grid; gap: 3px; min-width: 0; }
.rolepick__name { font-size: 15.5px; font-weight: 750; letter-spacing: -.01em; }
.rolepick__desc { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.rolepick__go { color: var(--ink-3); }

.auth__warn {
  display: flex;
  gap: var(--s3);
  margin-top: var(--s4);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}
.auth__warn .icon { flex: none; width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }

/* На телефоне брендовый блок сжимается до шапки: кнопки входа
   должны быть видны сразу, без прокрутки */
@media (max-width: 720px) {
  .auth__brand { padding: var(--s5) var(--s4); gap: var(--s3); }
  .auth__logo { height: 32px; }
  .auth__headline { font-size: 24px; }
  .auth__headline br { display: none; }
  .auth__lead { font-size: 14px; }
  .auth__points { display: none; }
  .auth__side { padding: var(--s5) var(--s4) var(--s7); }
  .auth__flag { padding: var(--s3); margin-bottom: var(--s4); font-size: 12.5px; }
  .rolepick { margin-top: var(--s4); }
  .rolepick__btn { padding: var(--s4); gap: var(--s3); }
  .rolepick__ic { width: 40px; height: 40px; }
}

@media (min-width: 900px) {
  .auth { grid-template-columns: 1.05fr .95fr; }
  .auth__brand { padding: var(--s9) var(--s8); justify-content: center; gap: var(--s6); }
  .auth__side { padding: var(--s8); }
}

/* ============================================================
   КАРКАС ПОРТАЛА
   ============================================================ */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.view {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  padding: var(--s7) var(--pad) calc(var(--s9) + var(--tabbar-h));
}
.view:focus { outline: none; }

/* ============================================================
   САЙДБАР
   ============================================================ */

.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s6) var(--s5) var(--s5);
}
.sidebar__logo { height: 36px; width: auto; }

/* Составной селектор нужен, чтобы перебить display у .icon-btn ниже по файлу */
.sidebar__close.icon-btn { display: none; }

/* --- Переключатель раздела --- */

.rolebar {
  display: grid;
  gap: var(--s2);
  padding: 0 var(--s5) var(--s5);
}
.rolebar__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1);
  padding: var(--s1);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--pill);
}
.segmented__btn {
  padding: var(--s2) var(--s2);
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  transition: background-color .16s ease, color .16s ease;
}
.segmented__btn:hover { color: var(--ink); }
.segmented__btn.is-active { background: var(--green); color: #fff; }

/* --- Навигация --- */

.nav {
  flex: 1;
  padding: var(--s2) var(--s3) var(--s5);
  display: grid;
  gap: 2px;
  align-content: start;
}

.nav__group {
  margin: var(--s5) 0 var(--s2);
  padding-inline: var(--s3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.nav__group:first-child { margin-top: var(--s2); }

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 42px;
  padding: var(--s2) var(--s3);
  border-radius: var(--r2);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease;
}
.nav__item:hover { background: var(--surface-2); color: var(--ink); }
.nav__item .icon { color: var(--ink-3); transition: color .15s ease; }

.nav__item.is-active { background: var(--green-soft); color: var(--green); }
.nav__item.is-active .icon { color: var(--green); }
.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 20px;
  margin-top: -10px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}

.nav__label { flex: 1; min-width: 0; }

.nav__badges { display: flex; gap: var(--s1); }
.nav__count {
  min-width: 22px;
  padding: 1px var(--s2);
  border-radius: var(--pill);
  background: var(--surface-3);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
}
.nav__item.is-active .nav__count { background: #fff; color: var(--green); }
.nav__count--alert { background: var(--accent); color: #fff; }
.nav__item.is-active .nav__count--alert { background: var(--accent); color: #fff; }

/* --- Низ сайдбара --- */

.sidebar__foot {
  padding: var(--s4) var(--s5) var(--s5);
  border-top: 1px solid var(--hairline-2);
  display: grid;
  gap: var(--s3);
}

.usercard {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r2);
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
}
.usercard__text { display: grid; min-width: 0; }
.usercard__name {
  font-size: 14px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.usercard__role {
  font-size: 12px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar__links { display: flex; gap: var(--s5); }

.linkbtn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-3);
  transition: color .15s ease;
}
.linkbtn:hover { color: var(--accent); }
.linkbtn .icon { width: 15px; height: 15px; }

/* ============================================================
   ТОПБАР
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: 76px;
  padding: var(--s4) var(--pad);
  background: rgba(244, 239, 228, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.topbar__burger.icon-btn { display: none; }
.topbar__logout.icon-btn { display: none; }

.topbar__title { min-width: 0; }
.topbar__crumb {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.topbar__crumb:empty { display: none; }

.topbar__h1 {
  font-size: clamp(20px, 2.6vw, 27px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

/* ============================================================
   НИЖНЯЯ НАВИГАЦИЯ (телефон)
   ============================================================ */

.tabbar { display: none; }

.tabbar__item {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: var(--s2) var(--s1) var(--s1);
  border-radius: var(--r2);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-3);
  min-width: 0;
}
.tabbar__item .icon { width: 22px; height: 22px; }
.tabbar__item.is-active { color: var(--green); }
.tabbar__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   ПРИМИТИВЫ
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3) var(--s5);
  border-radius: var(--pill);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease,
              border-color .16s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }

.btn--green  { background: var(--green); color: #fff; }
.btn--green:hover:not(:disabled)  { background: var(--green-2); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: var(--accent-2); }
.btn--ghost  { background: var(--surface); color: var(--ink); border: 1.5px solid var(--hairline); }
.btn--ghost:hover:not(:disabled)  { border-color: var(--ink-3); }
.btn--danger { background: var(--accent-soft); color: var(--accent-2); }
.btn--danger:hover:not(:disabled) { background: #f9dccf; }

.btn--lg    { padding: var(--s4) var(--s6); font-size: 15px; }
.btn--sm    { padding: var(--s2) var(--s4); font-size: 13px; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--pill);
  color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.backlink {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s5);
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-3);
}
.backlink:hover { color: var(--green); }
.backlink .icon { width: 17px; height: 17px; }

/* --- Аватар --- */

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--pill);
  background: var(--green);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.avatar--sm { width: 34px; height: 34px; font-size: 12px; }
.avatar--lg { width: 64px; height: 64px; font-size: 21px; }

/* --- Пилюли и чипы --- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 4px var(--s3);
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill .icon { width: 13px; height: 13px; }

.st-done     { background: var(--green-soft);  color: var(--green); }
.st-progress { background: var(--blue-soft);   color: var(--blue); }
.st-warn     { background: var(--gold-soft);   color: var(--gold); }
.st-test     { background: var(--accent-soft); color: var(--accent-2); }
.st-new      { background: var(--surface-3);   color: var(--ink-3); }

.pill--trainee { background: var(--purple-soft); color: var(--purple); }
.pill--req     { background: var(--accent-soft); color: var(--accent-2); }
.pill--admin   { background: var(--green); color: #fff; }
.pill--outline { background: transparent; border: 1px solid var(--hairline); color: var(--ink-3); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s1) var(--s3);
  border-radius: var(--pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent-2);
}

/* --- Полоса прогресса --- */

.bar {
  height: 6px;
  border-radius: var(--pill);
  background: var(--surface-3);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  border-radius: var(--pill);
  background: var(--green-2);
  transition: width .4s ease;
}
.bar__fill--gold   { background: var(--gold); }
.bar__fill--accent { background: var(--accent); }
.bar__fill--blue   { background: var(--blue); }
.bar__fill--flat   { background: var(--hairline); }

.progress-row { display: flex; align-items: center; gap: var(--s3); }
.progress-row .bar { flex: 1; min-width: 56px; }
.progress-row__val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Кольцо --- */

.ring { display: block; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-3); }
.ring__fill  { fill: none; stroke: var(--green-2); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }

.ringbox { position: relative; display: grid; place-items: center; flex: none; }
.ringbox__text { position: absolute; display: grid; justify-items: center; }
.ringbox__num {
  font-size: 25px; font-weight: 800; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ringbox__cap { margin-top: 3px; font-size: 10.5px; font-weight: 650; color: var(--ink-3); }

/* --- Уведомление --- */

.alert {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  font-size: 13.5px;
  line-height: 1.5;
}
.alert--error { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.alert--ok    { background: var(--green-soft);  color: var(--green); font-weight: 600; }

/* ============================================================
   БЛОКИ И СЕТКИ
   ============================================================ */

.stack        { display: grid; gap: var(--s6); }
.stack--tight { gap: var(--s4); }
.stack--loose { gap: var(--s7); }

.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row--end { margin-left: auto; }

.block { display: grid; gap: var(--s4); }
.block__head {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
}
.block__title {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.015em;
}
.block__action { margin-left: auto; flex: none; }
/* Кнопке сжиматься нельзя, а поясняющей строке — можно и нужно,
   иначе длинная подпись выпирает за край экрана */
.hint.block__action,
.hint.panel__action { flex: 0 1 auto; min-width: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
}
.panel__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--hairline-2);
}
.panel__title { font-size: 15.5px; font-weight: 750; }
.panel__action { margin-left: auto; flex: none; }
.panel__body { padding: var(--s5); }
.panel__body--flush { padding: 0; }

.hint { font-size: 13px; line-height: 1.5; color: var(--ink-3); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s4);
}

/* ============================================================
   ШАПКА СУЩНОСТИ (профиль, курс, отдел)
   ============================================================ */

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s5);
  padding: var(--s6);
}
.hero__main { display: grid; gap: var(--s1); min-width: 0; flex: 1; }
.hero__name {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.hero__sub { font-size: 14.5px; color: var(--ink-2); }
.hero__badges { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.hero__ring { margin-left: auto; }

/* ============================================================
   ПОКАЗАТЕЛИ
   ============================================================ */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s4);
}

.kpi {
  display: grid;
  gap: var(--s2);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
}
.kpi__top { display: flex; align-items: center; gap: var(--s3); }
.kpi__ic {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--r1);
  background: var(--green-soft);
  color: var(--green);
}
.kpi__ic .icon { width: 18px; height: 18px; }
.kpi__label { font-size: 12.5px; font-weight: 650; color: var(--ink-3); line-height: 1.3; }
.kpi__value {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi__note { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }

.kpi--alert { border-color: #edc6b4; background: var(--accent-soft); }
.kpi--alert .kpi__ic { background: #fff; color: var(--accent); }
.kpi--alert .kpi__value { color: var(--accent-2); }
.kpi--alert .kpi__label,
.kpi--alert .kpi__note { color: var(--accent-2); }

/* ============================================================
   СРОКИ ОБУЧЕНИЯ
   ============================================================ */

.period {
  display: grid;
  gap: var(--s5);
  padding: var(--s6);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
}
.period--overdue { border-color: #edc6b4; background: var(--accent-soft); }
.period--soon    { border-color: #ecd9a8; background: var(--gold-soft); }

.period__head { display: flex; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; }
.period__ic {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border-radius: var(--r2);
  background: var(--surface-2);
  color: var(--ink-2);
}
.period--overdue .period__ic { background: #fff; color: var(--accent); }
.period--soon .period__ic    { background: #fff; color: var(--gold); }

.period__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.period__dates {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.01em;
}
.period__pill { margin-left: auto; }

.period__left {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
}
.period__num {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.period--overdue .period__num { color: var(--accent-2); }
.period__unit { font-size: 13.5px; color: var(--ink-3); }

.period__meters { display: grid; gap: var(--s3); }
.meter { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: var(--s3); }
.meter__name { font-size: 12.5px; color: var(--ink-3); }
.meter__val {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  min-width: 36px; text-align: right; font-variant-numeric: tabular-nums;
}

.period__note {
  display: flex;
  gap: var(--s2);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.period__note .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }

/* Две строки в ячейке таблицы: главное сверху, уточнение снизу */
.twoline { display: grid; gap: 2px; min-width: 0; }
.twoline__main {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.twoline__sub {
  font-size: 12px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Компактная строка сроков в таблицах */
.dates { display: grid; gap: 2px; }
.dates__range { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dates__left  { font-size: 12px; color: var(--ink-3); }
.dates__left--bad { color: var(--accent-2); font-weight: 650; }

/* ============================================================
   ТОНА ОТДЕЛОВ
   ============================================================ */

.tone-red    { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.tone-green  { --tone: var(--green);  --tone-soft: var(--green-soft); }
.tone-blue   { --tone: var(--blue);   --tone-soft: var(--blue-soft); }
.tone-gold   { --tone: var(--gold);   --tone-soft: var(--gold-soft); }
.tone-purple { --tone: var(--purple); --tone-soft: var(--purple-soft); }

.tile {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border-radius: var(--r2);
  background: var(--tone-soft, var(--green-soft));
  color: var(--tone, var(--green));
}
.tile--sm { width: 36px; height: 36px; border-radius: var(--r1); }
.tile--lg { width: 56px; height: 56px; border-radius: var(--r3); }
.tile--sm .icon { width: 18px; height: 18px; }

/* ============================================================
   КАРТОЧКА ОТДЕЛА
   ============================================================ */

.dept {
  display: grid;
  gap: var(--s4);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
  text-align: left;
  transition: box-shadow .2s ease, transform .18s ease, border-color .18s ease;
}
a.dept:hover { box-shadow: var(--sh2); transform: translateY(-2px); border-color: var(--tone, var(--green)); }

.dept__top { display: flex; align-items: center; gap: var(--s4); }
.dept__name { font-size: 16.5px; font-weight: 750; letter-spacing: -.01em; }
.dept__meta { font-size: 12.5px; color: var(--ink-3); }
.dept__desc { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.dept__foot { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }

.facepile { display: flex; }
.facepile .avatar {
  width: 30px; height: 30px; font-size: 10.5px;
  border: 2px solid var(--surface);
  margin-left: -9px;
  background: var(--tone, var(--green));
}
.facepile .avatar:first-child { margin-left: 0; }
.facepile__more {
  display: grid; place-items: center;
  width: 30px; height: 30px; margin-left: -9px;
  border: 2px solid var(--surface);
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
}

/* ============================================================
   КАРТОЧКА КУРСА
   ============================================================ */

.course {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
  text-align: left;
  transition: box-shadow .2s ease, transform .18s ease, border-color .18s ease;
}
a.course:hover { box-shadow: var(--sh2); transform: translateY(-2px); border-color: var(--green-2); }

.course__top { display: flex; align-items: flex-start; gap: var(--s4); }
.course__head { min-width: 0; display: grid; gap: var(--s2); }
.course__title { font-size: 16px; font-weight: 750; line-height: 1.3; letter-spacing: -.01em; }
.course__summary { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); flex: 1; }

.badges { display: flex; flex-wrap: wrap; gap: var(--s1); }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  font-size: 12.5px;
  color: var(--ink-3);
}
.meta span { display: inline-flex; align-items: center; gap: var(--s1); }
.meta .icon { width: 14px; height: 14px; }

.course__foot { display: grid; gap: var(--s2); margin-top: auto; }

/* ============================================================
   ТАБЛИЦА ЛЮДЕЙ / КУРСОВ
   ============================================================ */

.table { display: grid; }

.table__head {
  display: grid;
  gap: var(--s4);
  padding: var(--s3) var(--s5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.row-item {
  display: grid;
  gap: var(--s4);
  align-items: center;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--hairline-2);
  text-align: left;
  transition: background-color .15s ease;
}
.row-item:last-child { border-bottom: 0; }
a.row-item:hover { background: var(--surface-2); }

/* Колонки: кто | отдел/подпись | сроки | прогресс | стрелка */
.cols-people .table__head,
.cols-people .row-item {
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.1fr) minmax(0, 1.35fr) 150px 20px;
}
/* Колонки: курс | статус | прогресс | стрелка */
.cols-courses .table__head,
.cols-courses .row-item {
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) 150px 20px;
}
/* Колонки: отдел | человек | возраст | стаж | прогресс */
.cols-team .table__head,
.cols-team .row-item {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 150px;
}

.who { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.who__text { display: grid; min-width: 0; }
.who__name {
  font-size: 14.5px; font-weight: 700; letter-spacing: -.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who__sub {
  font-size: 12.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell { font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.cell--go { color: var(--ink-3); justify-self: end; }

/* ============================================================
   МОДУЛИ И УРОКИ
   ============================================================ */

.module { border-bottom: 1px solid var(--hairline-2); }
.module:last-child { border-bottom: 0; }

.module__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s2);
}
.num {
  display: grid; place-items: center;
  width: 26px; height: 26px; flex: none;
  border-radius: var(--pill);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 12px; font-weight: 700; color: var(--ink-3);
}
.module__title { font-size: 14px; font-weight: 750; }

.lesson {
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  padding: var(--s3) var(--s5) var(--s3) calc(var(--s5) + var(--s2));
  text-align: left;
  transition: background-color .15s ease;
}
a.lesson:hover { background: var(--surface-2); }

.lesson__mark {
  display: grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border-radius: var(--pill);
  border: 1.5px solid var(--hairline);
  color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.lesson.is-done .lesson__mark { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.lesson__mark .icon { width: 14px; height: 14px; }
.lesson__mark--flat { border-style: dashed; }

.lesson__title { font-size: 14.5px; font-weight: 600; flex: 1; min-width: 0; }
.lesson.is-done .lesson__title { color: var(--ink-3); }
.lesson__time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ============================================================
   ЧТЕНИЕ УРОКА
   ============================================================ */

.reader { max-width: 720px; }
.reader__kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s2);
}
.reader__title {
  font-size: clamp(24px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.2;
  margin-bottom: var(--s6);
}
.reader__body { display: grid; gap: var(--s4); font-size: 16px; line-height: 1.68; }
.reader__body p { color: var(--ink-2); }

.reader__body ul { display: grid; gap: var(--s3); }
.reader__body li { display: flex; align-items: flex-start; gap: var(--s3); color: var(--ink-2); }
.reader__body li::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  margin-top: 10px;
  border-radius: var(--pill);
  background: var(--green-2);
}

.note {
  display: flex;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-radius: var(--r2);
  background: var(--accent-soft);
  border: 1px solid #f2d5c8;
  color: var(--accent-2);
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.55;
}
.note .icon { flex: none; color: var(--accent); margin-top: 2px; }

.reader__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  margin-top: var(--s8);
  padding-top: var(--s6);
  border-top: 1px solid var(--hairline);
}

/* ============================================================
   ТЕСТ
   ============================================================ */

.quiz { max-width: 720px; display: grid; gap: var(--s4); }
.quiz__meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-size: 13px; color: var(--ink-3); }
.quiz__meta span { display: inline-flex; align-items: center; gap: var(--s1); }
.quiz__meta .icon { width: 15px; height: 15px; }

.q {
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
}
.q__num {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s2);
}
.q__text { font-size: 16px; font-weight: 700; line-height: 1.4; margin-bottom: var(--s4); }

.opts { display: grid; gap: var(--s2); }

.opt {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r2);
  background: var(--surface-2);
  font-size: 14.5px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.opt:hover { border-color: var(--ink-3); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }

.opt__dot {
  display: grid; place-items: center;
  width: 20px; height: 20px; flex: none;
  margin-top: 1px;
  border: 1.5px solid var(--hairline);
  border-radius: var(--pill);
  background: #fff;
}
.opt__dot::after {
  content: "";
  width: 9px; height: 9px;
  border-radius: var(--pill);
  background: transparent;
  transition: background-color .15s ease;
}
.opt:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.opt:has(input:checked) .opt__dot { border-color: var(--green); }
.opt:has(input:checked) .opt__dot::after { background: var(--green); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.q.is-right { border-color: #b7d5c3; }
.q.is-wrong { border-color: #eec1ae; }

.opt.is-correct     { border-color: var(--green-2); background: var(--green-soft); }
.opt.is-chosen-wrong { border-color: var(--accent); background: var(--accent-soft); }
.opt__flag { margin-left: auto; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.opt.is-correct .opt__flag { color: var(--green); }
.opt.is-chosen-wrong .opt__flag { color: var(--accent-2); }

.quiz__actions { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; }

/* --- Результат --- */

.result {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  padding: var(--s8) var(--s6);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
  text-align: center;
}
.result__icon {
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border-radius: var(--pill);
  margin-bottom: var(--s2);
}
.result__icon .icon { width: 32px; height: 32px; }
.result--pass .result__icon { background: var(--green-soft); color: var(--green); }
.result--fail .result__icon { background: var(--accent-soft); color: var(--accent); }
.result__score { font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.result__title { font-size: 20px; font-weight: 750; }
.result__text { font-size: 14px; line-height: 1.55; color: var(--ink-2); max-width: 44ch; }
.result__actions { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; margin-top: var(--s4); }

/* ============================================================
   ЧЕК-ЛИСТ
   ============================================================ */

.shift { border-bottom: 1px solid var(--hairline-2); }
.shift:last-child { border-bottom: 0; }

.shift__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s5) var(--s5) var(--s2);
}
.shift__title { font-size: 14.5px; font-weight: 750; }
.shift__count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.shift__bar { padding: 0 var(--s5) var(--s4); }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  width: 100%;
  padding: var(--s3) var(--s5) var(--s3) calc(var(--s5) + var(--s2));
  text-align: left;
  transition: background-color .15s ease;
}
.check:hover { background: var(--surface-2); }

.check__box {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex: none;
  margin-top: 1px;
  border: 1.5px solid var(--hairline);
  border-radius: var(--r1);
  color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.check.is-done .check__box { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.check__box .icon { width: 14px; height: 14px; }

.check__text { font-size: 14.5px; line-height: 1.45; }
.check.is-done .check__text { color: var(--ink-3); text-decoration: line-through; }

/* ============================================================
   СПИСОК ЗНАЧЕНИЙ
   ============================================================ */

.deflist { display: grid; }
.deflist__row {
  display: flex;
  flex-wrap: wrap;                 /* длинное значение уходит на вторую строку,
                                      а не выдавливается за край */
  justify-content: space-between;
  gap: 2px var(--s5);
  padding: var(--s3) 0;
  border-bottom: 1px dashed var(--hairline);
  font-size: 14px;
}
.deflist__row:last-child { border-bottom: 0; }
.deflist__key { color: var(--ink-3); min-width: 0; }
.deflist__val { font-weight: 650; text-align: right; min-width: 0; }

/* ============================================================
   ПУСТОЕ СОСТОЯНИЕ, ПАНЕЛЬ ИНСТРУМЕНТОВ
   ============================================================ */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  padding: var(--s9) var(--s5);
  text-align: center;
  color: var(--ink-3);
}
.empty .icon { width: 40px; height: 40px; color: var(--hairline); margin-bottom: var(--s2); }
.empty strong { color: var(--ink); font-size: 15px; }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }

.search { position: relative; flex: 1; min-width: 220px; }
.search__icon {
  position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}
.search__input {
  width: 100%;
  padding: var(--s3) var(--s4) var(--s3) calc(var(--s6) + var(--s4));
  border: 1.5px solid var(--hairline);
  border-radius: var(--pill);
  background: var(--surface);
  font-size: 14px;
}
.search__input:focus { border-color: var(--green); }

.filters { display: flex; gap: var(--s2); flex-wrap: wrap; }
.filter {
  padding: var(--s2) var(--s4);
  border: 1.5px solid var(--hairline);
  border-radius: var(--pill);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.filter:hover { border-color: var(--green-2); color: var(--green); }
.filter.is-active { background: var(--green); border-color: var(--green); color: #fff; }

/* ============================================================
   ФОРМЫ
   ============================================================ */

.field { display: grid; gap: var(--s2); min-width: 0; }
.field__label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.req { color: var(--accent); }

.field__wrap { position: relative; display: block; }
.field__icon {
  position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none;
}

.field__control {
  width: 100%;
  padding: var(--s3) var(--s4);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r2);
  background: var(--surface);
  font-size: 15px;
  transition: border-color .15s ease, background-color .15s ease;
}
.field__control--icon { padding-left: calc(var(--s6) + var(--s4)); }
.field__control::placeholder { color: var(--ink-3); }
.field__control:focus { border-color: var(--green); }
.field__control.is-invalid { border-color: var(--accent); background: var(--accent-soft); }

/* Поля даты.
   На телефоне это нативный контрол: iOS держит собственную ширину
   и игнорирует width, из-за чего поле вылезает за карточку.
   Сбрасываем системный вид и разрешаем сжиматься. */
input[type="date"].field__control {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
}
input[type="date"].field__control::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}
input[type="date"].field__control::-webkit-calendar-picker-indicator {
  margin-left: auto;
  flex: none;
}

.field__error { font-size: 12.5px; font-weight: 600; color: var(--accent-2); }

.form { display: grid; gap: var(--s4); }
.form__legend {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: var(--s2);
}
.form__legend:not(:first-child) {
  margin-top: var(--s3);
  padding-top: var(--s5);
  border-top: 1px solid var(--hairline-2);
}
/* minmax(0, 1fr), а не 1fr: иначе колонка не может стать уже своего
   содержимого, и нативное поле даты распирает сетку */
.form__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); }
.field--full { grid-column: 1 / -1; }
.form__hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.form__actions {
  display: flex;
  gap: var(--s3);
  justify-content: flex-end;
  margin-top: var(--s3);
  padding-top: var(--s5);
  border-top: 1px solid var(--hairline-2);
}

/* ============================================================
   МОДАЛКА
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(23, 21, 15, .52);
  opacity: 0;
  transition: opacity .2s ease;
  overflow-y: auto;
}
.modal.is-open { opacity: 1; }

.modal__dialog {
  width: min(520px, 100%);
  margin-top: auto;
  background: var(--bg);
  border-radius: var(--r5) var(--r5) 0 0;
  box-shadow: var(--sh3);
  transform: translateY(20px);
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}
.modal__dialog--wide   { width: min(660px, 100%); }
.modal__dialog--narrow { width: min(420px, 100%); }
.modal.is-open .modal__dialog { transform: translateY(0); }

/* --- Окно подтверждения --- */

.ask {
  display: grid;
  justify-items: center;
  gap: var(--s3);
  padding: var(--s7) var(--s6) calc(var(--s6) + env(safe-area-inset-bottom));
  text-align: center;
}
.ask__icon {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  margin-bottom: var(--s1);
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent);
}
.ask__icon .icon { width: 26px; height: 26px; }
.ask__title { font-size: 19px; font-weight: 800; letter-spacing: -.015em; }
.ask__text { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); max-width: 40ch; }
.ask__actions {
  display: flex;
  gap: var(--s3);
  justify-content: center;
  width: 100%;
  margin-top: var(--s4);
}
.ask__actions .btn { flex: 1; max-width: 190px; }

@media (max-width: 720px) {
  .ask { padding: var(--s6) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); }
  .ask__actions { flex-direction: column-reverse; }
  .ask__actions .btn { max-width: none; }
}

.modal__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s5) var(--s4) var(--s4) var(--s6);
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.modal__title { font-size: 18px; font-weight: 800; letter-spacing: -.015em; }
.modal__sub { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.modal__head .icon-btn { margin-left: auto; }
.modal__body { padding: var(--s6) var(--s6) calc(var(--s6) + env(safe-area-inset-bottom)); }

/* ============================================================
   КАРТОЧКА ПРОГРАММЫ
   ============================================================ */

.course__sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.course__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  margin-top: var(--s1);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green);
}
.course__cta .icon { width: 16px; height: 16px; }

/* ============================================================
   СТРАНИЦА ПРАВИЛ
   ============================================================ */

.reader { max-width: 760px; }

.reader__top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.reader__program { font-size: 14px; font-weight: 700; color: var(--ink-2); }

.pager {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s5);
  flex-wrap: wrap;
}
.pager__dot {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--pill);
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.pager__dot:hover { border-color: var(--green-2); color: var(--green); }
.pager__dot.is-read { background: var(--green-soft); border-color: var(--green-soft); color: var(--green); }
.pager__dot.is-current { background: var(--green); border-color: var(--green); color: #fff; }
.pager__label { margin-left: var(--s2); font-size: 13px; color: var(--ink-3); }

.reader__h {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.01em;
  margin-top: var(--s3);
}
.reader__h:first-child { margin-top: 0; }

/* ============================================================
   ИЛЛЮСТРАЦИИ, ФОТО И ВИДЕО
   ============================================================ */

.figure {
  position: relative;
  margin: 0;
  border-radius: var(--r3);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
}
.figure svg,
.figure__media {
  display: block;
  width: 100%;
  height: auto;
}
.figure__media { aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-3); }
video.figure__media { object-fit: contain; background: #17150f; }

.figure__cap {
  padding: var(--s2) var(--s4) var(--s3);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
  background: var(--surface);
  border-top: 1px solid var(--hairline-2);
}

.figure--scheme { margin-bottom: var(--s5); }
.figure--scheme svg { background: var(--surface-2); }

.figure__del {
  position: absolute;
  top: var(--s2); right: var(--s2);
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, .94);
  color: var(--accent);
  box-shadow: var(--sh1);
}
.figure__del:hover { background: var(--accent); color: #fff; }
.figure__del .icon { width: 16px; height: 16px; }

.media { margin-top: var(--s5); display: grid; gap: var(--s3); }
.media__title {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3);
}
.media__title .icon { width: 15px; height: 15px; }
.media__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s3);
}
.media__add { justify-self: start; }

/* ============================================================
   ДОКУМЕНТ
   ============================================================ */

.doccard {
  display: grid;
  gap: var(--s2);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
  transition: box-shadow .2s ease, transform .18s ease, border-color .18s ease;
}
a.doccard:hover { box-shadow: var(--sh2); transform: translateY(-2px); border-color: var(--tone, var(--green)); }

.doccard__seal {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--pill);
  background: var(--green-soft);
  color: var(--green);
  margin-bottom: var(--s1);
}
.doccard__label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.doccard__title { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.doccard__meta { font-size: 13px; color: var(--ink-2); }

.doc {
  max-width: 720px;
  padding: var(--s8) var(--s7);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r3);
  box-shadow: var(--sh1);
}
.doc__head {
  display: flex; align-items: flex-start; gap: var(--s4);
  padding-bottom: var(--s5);
  border-bottom: 2px solid var(--green);
}
.doc__org { font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: var(--green); }
.doc__kind {
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  margin-top: 2px;
}
.doc__seal {
  display: grid; place-items: center;
  width: 54px; height: 54px;
  margin-left: auto;
  border-radius: var(--pill);
  background: var(--green);
  color: #fff;
}

.doc__title {
  font-size: 27px; font-weight: 800; letter-spacing: -.025em; line-height: 1.2;
  margin-top: var(--s6);
}
.doc__sub { font-size: 14.5px; color: var(--ink-3); margin-top: var(--s1); }

.doc__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
  margin-top: var(--s6);
  padding: var(--s5);
  border-radius: var(--r2);
  background: var(--surface-2);
}
.doc__fact { display: grid; gap: 2px; min-width: 0; }
.doc__fact-key {
  font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.doc__fact-val { font-size: 15px; font-weight: 650; }

.doc__memo { margin-top: var(--s6); }
.doc__memo-title {
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: var(--s3);
}
.doc__list { counter-reset: memo; display: grid; gap: var(--s3); }
.doc__list li {
  position: relative;
  padding-left: var(--s7);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}
.doc__list li::before {
  counter-increment: memo;
  content: counter(memo);
  position: absolute;
  left: 0; top: 1px;
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: var(--pill);
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px; font-weight: 800;
}

.doc__foot {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px dashed var(--hairline);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* ============================================================
   ЛЕНТА АКТИВНОСТИ
   ============================================================ */

.feed { display: grid; }

.feed__day {
  padding: var(--s4) var(--s5) var(--s2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline-2);
}
.feed__day:first-child { padding-top: var(--s3); }

.event {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  border-bottom: 1px solid var(--hairline-2);
}
.event:last-child { border-bottom: 0; }

.event__ic {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--ink-3);
}
.event__ic .icon { width: 16px; height: 16px; }

.ev-read  .event__ic { background: var(--blue-soft);   color: var(--blue); }
.ev-pass  .event__ic { background: var(--green-soft);  color: var(--green); }
.ev-fail  .event__ic { background: var(--accent-soft); color: var(--accent); }
.ev-check .event__ic { background: var(--gold-soft);   color: var(--gold); }

.event__body { display: grid; gap: 1px; min-width: 0; }
.event__who { font-size: 13px; font-weight: 700; color: var(--green); }
.event__who:hover { text-decoration: underline; }
.event__text { font-size: 14px; line-height: 1.45; color: var(--ink-2); }

.event__when {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  text-align: right;
}
.event__seed {
  font-size: 10.5px;
  padding: 1px var(--s2);
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--ink-3);
}

/* ============================================================
   ЧЕК-ЛИСТ: ЗАМОК И АВТОРСТВО ОТМЕТКИ
   ============================================================ */

.check--locked { cursor: default; }
.check--locked:hover { background: transparent; }

.check__by {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.checknote {
  display: flex;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline-2);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.checknote .icon { flex: none; width: 16px; height: 16px; color: var(--green); margin-top: 2px; }

.alert--info { background: var(--blue-soft); color: var(--blue); font-weight: 550; }
.alert--info .icon { flex: none; }
.alert .icon { flex: none; margin-top: 1px; }

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ В ФОРМЕ
   ============================================================ */

.switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
}
.switcher .field__label { grid-column: 1 / -1; }

.switcher__opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r2);
  background: var(--surface);
  font-weight: 650;
  font-size: 14.5px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.switcher__opt input { position: absolute; opacity: 0; pointer-events: none; }
.switcher__opt:hover { border-color: var(--green-2); }
.switcher__opt:has(input:checked) { border-color: var(--green); background: var(--green); color: #fff; }
.switcher__opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Страница программы в админке */
.progpage .panel__head { gap: var(--s3); }

/* ============================================================
   ПЕЧАТЬ ДОКУМЕНТА
   ============================================================ */

@media print {
  .sidebar, .topbar, .tabbar, .backlink, .modal, .sidebar-backdrop { display: none !important; }
  .layout { display: block; }
  .view { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .row { display: none; }
}

/* ============================================================
   АДАПТИВ — планшет
   ============================================================ */

@media (max-width: 1099px) {
  :root { --pad: var(--s5); }

  .layout { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--sh3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close.icon-btn { display: inline-grid; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(23, 21, 15, .45);
    opacity: 0;
    transition: opacity .22s ease;
  }
  .sidebar-backdrop.is-visible { opacity: 1; }

  .topbar__burger.icon-btn { display: inline-grid; }
  .topbar__logout.icon-btn { display: inline-grid; }

  /* Сроки уходят из таблицы — они остаются в карточке сотрудника */
  .cols-people .table__head,
  .cols-people .row-item {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) 140px 20px;
  }
  .cols-people .col-dept,
  .cols-people .cell--dept { display: none; }
}

/* ============================================================
   АДАПТИВ — телефон
   ============================================================ */

@media (max-width: 720px) {
  :root { --pad: var(--s4); --tabbar-h: 68px; }

  body { font-size: 14.5px; }

  .view { padding-top: var(--s5); }

  .topbar { min-height: 64px; padding-block: var(--s3); }
  .topbar__h1 { font-size: 19px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .kpi { padding: var(--s4); gap: var(--s1); }
  .kpi__ic { width: 30px; height: 30px; }
  .kpi__value { font-size: 24px; }
  .kpi__note { display: none; }

  .grid-cards { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }

  .hero { padding: var(--s5); gap: var(--s4); }
  .hero__name { font-size: 20px; }
  .hero__ring { margin-left: 0; }
  /* Без нижней границы текстовый блок сжимается до нуля, и имя с метками
     вылезает за карточку. Порог заставляет кольцо перенестись на строку ниже. */
  .hero__main { flex: 1 1 180px; min-width: 180px; }

  .period { padding: var(--s5); gap: var(--s4); }
  .period__dates { font-size: 15.5px; }
  .period__pill { margin-left: 0; }
  .meter { grid-template-columns: 118px 1fr auto; }

  /* Строка человека превращается в карточку */
  .table__head { display: none; }
  .cols-people .row-item,
  .cols-courses .row-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--s3);
    padding: var(--s4);
  }
  .cols-people .cell--dept,
  .cols-people .cell--dates,
  .cols-people .cell--progress,
  .cols-courses .cell--status,
  .cols-courses .cell--progress { grid-column: 1 / -1; }
  .cols-people .cell--go,
  .cols-courses .cell--go { grid-row: 1; grid-column: 2; }

  /* На телефоне отдел показываем — это часть «видеть всё» */
  .cols-people .cell--dept { display: block; }

  .cols-team .row-item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s2) var(--s3);
    padding: var(--s4);
  }
  .cols-team .who { grid-column: 1 / -1; }
  .cols-team .cell--progress { grid-column: 1 / -1; }

  /* Шапка таблицы скрыта — подписываем значения прямо в ячейке */
  .cell[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--ink-3);
  }

  .panel__body { padding: var(--s4); }
  .panel__head { padding: var(--s4); }
  .lesson, .check { padding-inline: var(--s4) var(--s4); }
  .module__head, .shift__head, .shift__bar { padding-inline: var(--s4); }

  .form__grid { grid-template-columns: minmax(0, 1fr); }
  .form__actions { flex-direction: column-reverse; }
  .form__actions .btn { width: 100%; }

  .modal__body { padding: var(--s5); }
  .modal__head { padding: var(--s4) var(--s3) var(--s4) var(--s5); }

  .reader__foot { margin-top: var(--s6); }
  .reader__foot .btn { flex: 1; }

  .media__grid { grid-template-columns: minmax(0, 1fr); }

  /* Поясняющая строка уходит под заголовок, а не жмётся сбоку */
  .block__head, .panel__head { flex-wrap: wrap; }
  .hint.block__action,
  .hint.panel__action { margin-left: 0; flex-basis: 100%; }

  .doc { padding: var(--s5) var(--s4); }
  .doc__title { font-size: 22px; margin-top: var(--s5); }
  .doc__facts { grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s4); }
  .doc__seal { width: 44px; height: 44px; }
  .doc__list li { padding-left: var(--s6); font-size: 14.5px; }

  /* Лента: время уходит под текст, чтобы не резать строку */
  .event {
    grid-template-columns: 32px minmax(0, 1fr);
    padding-inline: var(--s4);
  }
  .event__when { grid-column: 2; justify-items: start; text-align: left; }

  /* --- Нижняя навигация --- */
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: var(--s1);
    padding: var(--s2) var(--s2) calc(var(--s2) + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--hairline);
  }
}

@media (min-width: 721px) {
  .modal { align-items: center; padding: var(--s5); }
  .modal__dialog { margin-block: auto; border-radius: var(--r4); }
  .modal__head { border-radius: var(--r4) var(--r4) 0 0; }
}
