/* ==========================================================================
   ERKON Intranet — дизайн-система
   Две темы (§37), изумрудный акцент (§39): светлая — основная, утверждённый вариант «Промышленный зелёный»
   (светлая страница с зеленоватым отливом, белые карточки и шапка с изумрудной кромкой, почти чёрный текст,
   изумрудные кнопки, ссылки и метки; жёлтый — только «Закреплено», свечение фокуса полей и иконка в карточке
   «Сегодня»), тёмная — графит §7.1 с тем же изумрудным акцентом и без жёлтого вовсе.
   Острые углы (2px). Токены см. docs/ARCHITECTURE.md §7.1, §37 и §39 — имена обязательны.
   Тема выбирается атрибутом data-theme у <html> (сервер ставит его по cookie erkon.theme).
   Правило: оба блока ниже определяют один и тот же набор токенов; цвета в правилах — только через токены
   (кроме печати, она всегда светлая).
   ========================================================================== */

/* Светлая тема — по умолчанию (§39: токены docs/theme-green-light.approved.css) */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --crop-outline: #FFFFFF;
  --crop-overlay: rgba(0, 0, 0, .6);
  --bg: #EBF0ED;          /* фон страницы — светлый, с зеленоватым отливом */
  --bg-elev: #FFFFFF;     /* карточки, шапка */
  --bg-elev-2: #F3F6F4;   /* вторичные плашки, hover */
  --bg-elev-3: #E3EAE6;   /* нажатое / выбранное */
  --line: #D8DFDB;        /* тонкие границы */
  --line-strong: #BCC7C1;
  --text: #16201B;
  --text-muted: #3D4843;
  --text-dim: #58645E;    /* ≥ 4.5:1 и на карточке, и на фоне страницы */
  --accent: #0B6B4F;      /* изумрудный — заливка основной кнопки, «Сейчас», «Обложка» */
  --accent-ink: #FFFFFF;  /* текст на изумрудной заливке */
  --ok: #2A7430;
  --warn: #8A6100;
  --danger: #C62828;
  --radius: 2px;
  --font: "Inter", "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  --font-display: "Oswald", "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --container: 1280px;
  --shadow: 0 1px 2px rgba(12, 48, 35, .06), 0 3px 12px rgba(12, 48, 35, .04);

  /* производные (§37, §39) */
  --header-h: 64px;
  --text-hover: #0A6446;             /* ссылки при наведении — изумрудные */
  --accent-text: #0A6446;            /* акцент текстом и иконками, метки состояния (активный пункт, вкладка, сегмент,
                                        выбранный фильтр): ≥ 4.5:1 к карточке и фону */
  --accent-text-hover: #074B34;      /* при наведении — темнее, а не бледнее */
  --accent-line: #14946A;            /* декоративные полосы (верх карточки входа, текущий месяц, обложка альбома) */
  --accent-edge: #09593F;            /* кромка изумрудной кнопки */
  --accent-hover: #08573F;
  --accent-hover-edge: #064631;
  --chip-bg: #E1EFE8;                /* мятная плашка под иконкой заголовка карточки, наведение на «Разделы» */
  --attention: #8A5A00;              /* «Нет дня рождения», незаполненное поле: янтарный — зелёный значит «в порядке» */
  --attention-hover: #6B4600;
  --attention-line: #E0A800;         /* полоса у строки без дня рождения, примечание над списком */
  --focus-ring: #0B6B4F;
  --control-accent: #0B6B4F;         /* checkbox / radio */
  --field-bg: #FFFFFF;
  --field-border: #78857F;           /* граница поля ≥ 3:1 к карточке и фону страницы */
  --field-border-hover: #53605A;
  --field-focus: #0B6B4F;
  --field-focus-ring: 0 0 0 1px #0B6B4F, 0 0 0 4px rgba(255, 238, 7, .55);  /* утверждённое жёлтое свечение */
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233D4843' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --danger-tint: rgba(198, 40, 40, .08);
  --tint: rgba(12, 60, 44, .05);
  --tint-strong: rgba(12, 60, 44, .1);
  --row-tint: rgba(12, 60, 44, .025);
  --shadow-pop: 0 14px 32px rgba(12, 48, 35, .16), 0 1px 0 rgba(12, 48, 35, .05);
  --page-glow: radial-gradient(1200px 420px at 15% -60px, rgba(31, 138, 99, .1), rgba(31, 138, 99, 0) 70%);
  --plate-bg: linear-gradient(180deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .94) 60%);
  --lightbox-bg: rgba(235, 240, 237, .97);
  --lightbox-shadow: 0 16px 48px rgba(20, 20, 22, .22);
  --logo-filter: none;               /* оригинальные тёмные буквы логотипа */
  --header-edge: linear-gradient(90deg, #0B6B4F, #1F9A6E);  /* изумрудная кромка над шапкой, 3px */
  --header-shadow: 0 1px 3px rgba(12, 48, 35, .05);
  --nav-active-line: #0B6B4F;        /* нижняя полоса активного пункта меню (десктоп) */
  --nav-active-bg: linear-gradient(0deg, rgba(11, 107, 79, .08), rgba(11, 107, 79, 0) 75%);
  --btn-primary-shadow: 0 1px 2px rgba(9, 59, 45, .18);
  /* Карточка «Сегодня» — глубокий изумруд в обеих темах */
  --today-bg: radial-gradient(360px 200px at 100% 0, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 70%),
    linear-gradient(155deg, #0E5541 0%, #0B4636 55%, #093B2D 100%);
  --today-border: #0A4232;
  --today-shadow: 0 10px 24px rgba(9, 59, 45, .18);
  --today-text: #FFFFFF;
  --today-text-muted: #D6EAE0;
  --today-text-dim: #BCDACD;
  --today-line: rgba(255, 255, 255, .16);
  --today-chip: rgba(255, 255, 255, .12);
  --today-accent: #FFEE07;           /* утверждённая жёлтая иконка «Сегодня» и фокус внутри карточки */
  --pinned-bg: #FFEE07;              /* «Закреплено» — утверждённая жёлтая плашка */
  --pinned-fg: #141414;
  --pinned-border: #E6D400;
  --avatar-ink-on-dark: #FFFFFF;     /* инициалы на тёмном цвете аватара */
  --avatar-ink-on-light: #141414;    /* инициалы на светлом цвете аватара */
  --avatar-ring: rgba(12, 48, 35, .1);
}

/* Тёмная тема — графитовые поверхности и текст §7.1 без изменений, акцент изумрудный, жёлтого нет (§39);
   под контраст §37 доведены граница поля и --danger. Только для экрана: печать всегда в светлых токенах */
@media screen {
:root[data-theme="dark"] {
  color-scheme: dark;
  --crop-outline: #FFFFFF;
  --crop-overlay: rgba(0, 0, 0, .6);
  --bg: #141414;
  --bg-elev: #1C1C1E;
  --bg-elev-2: #232326;
  --bg-elev-3: #2B2B2E;
  --line: #2B2B2B;
  --line-strong: #3A3A3E;
  --text: #E2E2E2;
  --text-muted: #A6A6AC;
  --text-dim: #7E7E7E;
  --accent: #2FB57F;      /* изумрудная заливка кнопок и бейджей */
  --accent-ink: #08140F;  /* почти чёрный текст на изумрудной заливке */
  --ok: #7BC67E;
  --warn: #F59E42;        /* предупреждения — оранжевые, не жёлтые */
  --danger: #EA7268;      /* светлее прежнего #E0564B: ≥ 4.5:1 на --bg-elev-3 и с подложкой --danger-tint (§39) */
  --radius: 2px;
  --font: "Inter", "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  --font-display: "Oswald", "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --container: 1280px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);

  /* производные (§37, §39) */
  --header-h: 64px;
  --text-hover: #FFFFFF;
  --accent-text: #3CC48F;
  --accent-text-hover: #5AD3A3;
  --accent-line: #3CC48F;
  --accent-edge: #2FB57F;
  --accent-hover: #3CC48F;
  --accent-hover-edge: #3CC48F;
  --chip-bg: rgba(60, 196, 143, .12);
  --attention: #F59E42;              /* «Нет дня рождения» — цветом предупреждения (--warn) */
  --attention-hover: #F9B470;
  --attention-line: #F59E42;
  --focus-ring: #3CC48F;
  --control-accent: #3CC48F;
  --field-bg: #232326;
  --field-border: #6E6E72;           /* граница поля ≥ 3:1 к карточке и фону страницы (§39; прежняя #2B2B2B — 1.2:1) */
  --field-border-hover: #8E8E94;
  --field-focus: #3CC48F;
  --field-focus-ring: 0 0 0 3px rgba(60, 196, 143, .22);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A6A6AC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --danger-tint: rgba(234, 114, 104, .08);  /* наведение на .btn-danger: текст ≥ 4.5:1 и в подсвеченной строке */
  --tint: rgba(255, 255, 255, .06);
  --tint-strong: rgba(255, 255, 255, .12);
  --row-tint: rgba(255, 255, 255, .015);
  --shadow-pop: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);
  --page-glow: radial-gradient(1200px 420px at 15% -60px, rgba(47, 181, 127, .07), rgba(47, 181, 127, 0) 70%);
  --plate-bg: linear-gradient(180deg, rgba(20, 20, 20, 0) 0, rgba(20, 20, 20, .88) 60%);
  --lightbox-bg: rgba(10, 10, 10, .94);
  --lightbox-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  --logo-filter: brightness(0) invert(0.89);  /* тёмно-синие буквы исходника -> светло-серые #E2E2E2 */
  --header-edge: linear-gradient(90deg, #1F9A6E, #3CC48F);
  --header-shadow: none;
  --nav-active-line: #3CC48F;
  --nav-active-bg: none;
  --btn-primary-shadow: none;
  --today-bg: radial-gradient(360px 200px at 100% 0, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 70%),
    linear-gradient(155deg, #0E5541 0%, #0B4636 55%, #093B2D 100%);
  --today-border: #13664D;
  --today-shadow: inset 0 2px 0 #3CC48F;  /* зелёная кромка сверху */
  --today-text: #FFFFFF;
  --today-text-muted: #D6EAE0;
  --today-text-dim: #BCDACD;
  --today-line: rgba(255, 255, 255, .16);
  --today-chip: rgba(255, 255, 255, .12);
  --today-accent: #7FE0B5;           /* светло-мятная иконка «Сегодня» вместо жёлтой */
  --pinned-bg: transparent;          /* «Закреплено» — зелёный контурный бейдж */
  --pinned-fg: #3CC48F;
  --pinned-border: #3CC48F;
  --avatar-ink-on-dark: #E2E2E2;
  --avatar-ink-on-light: #141414;
  --avatar-ring: transparent;
}
}

/* --------------------------------------------------------------------------
   База
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* Плавная смена темы по кнопке: public/js/app.js ставит класс на время переключения (не при первой отрисовке) */
@media (prefers-reduced-motion: no-preference) {
  :root.theme-switching,
  :root.theme-switching *,
  :root.theme-switching *::before,
  :root.theme-switching *::after {
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, fill .2s ease,
      stroke .2s ease, box-shadow .2s ease, filter .2s ease, outline-color .2s ease;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-glow), var(--bg);   /* мягкое изумрудное свечение сверху слева (§39) */
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text-hover); }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
dl { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
small { font-size: 13px; }
strong, b { font-weight: 600; }

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
[hidden] { display: none !important; }

.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;
}

/* Иконки — инлайн SVG 24×24, stroke=currentColor */
.icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.22em;
}

/* --------------------------------------------------------------------------
   Раскладка
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

main.container {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 56px;
}

/* --------------------------------------------------------------------------
   Типографика
   -------------------------------------------------------------------------- */
.eyebrow,
.card-title,
.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}

.display { font-family: var(--font-display); font-weight: 500; letter-spacing: .02em; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.page-title--normal { text-transform: none; letter-spacing: .01em; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.page-sub a { color: var(--text-muted); }

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }

/* «Все новости →» и т. п. — изумрудные (§39) */
.link-more {
  font-size: 13px;
  color: var(--accent-text);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  white-space: nowrap;
}
.link-more:hover { color: var(--accent-text-hover); text-decoration: underline; }

.prose { font-size: 15px; line-height: 1.65; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Шапка
   -------------------------------------------------------------------------- */
/* Шапка — цвета карточки, с изумрудной кромкой 3px сверху (§39) */
.site-header {
  height: var(--header-h);
  background: var(--header-edge) left top / 100% 3px no-repeat, var(--bg-elev);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--header-shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}
/* Официальный логотип (§21): в светлой теме — оригинальные тёмные буквы, в тёмной фильтр делает их светло-серыми (#E2E2E2), прозрачность сохраняется */
.logo-img { display: block; height: 26px; width: auto; filter: var(--logo-filter); }
.brand__tag {
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  max-width: 96px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
}
.nav-toggle .icon { width: 22px; height: 22px; }

.site-nav {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.site-nav--guest { justify-content: flex-end; }

.site-nav__list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  height: 100%;
}
.site-nav__link {
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}
.site-nav__link:hover { color: var(--text); }
.site-nav__link.is-active { color: var(--text); border-bottom-color: var(--nav-active-line); }
/* Активный пункт — изумрудной подписью (у скрытого от сотрудников раздела подпись остаётся приглушённой, см. v5) */
.site-nav__link.is-active:not(.is-restricted) { color: var(--accent-text); }

.site-nav__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
}
.site-nav__me { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.site-nav__me:hover .site-nav__name { text-decoration: underline; }
.site-nav__me .avatar { box-shadow: 0 0 0 1px var(--line-strong); }
.site-nav__me.is-active .avatar { box-shadow: 0 0 0 2px var(--accent-text); }
.site-nav__name { font-size: 13px; font-weight: 500; white-space: nowrap; }
.site-nav__minor {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
}
.site-nav__minor:hover { color: var(--text); }
.site-nav__minor.is-active { color: var(--text); }
.site-nav__minor .icon { width: 16px; height: 16px; }
.site-nav__sep { width: 1px; height: 20px; background: var(--line-strong); }

/* Десять пунктов меню (§21) должны помещаться в контейнер 1280px вместе с логотипом и блоком пользователя:
   на десктопе шапка всегда компактна — без подписи бренда и имени, подписи «Профиль»/«Выйти»
   остаются только для скринридеров, аватар ведёт в профиль. */
@media (min-width: 1100px) {
  .brand__tag { display: none; }
  .site-header__inner { gap: 20px; }
  .site-nav { gap: 10px; }
  .site-nav__link { padding: 0 7px; font-size: 12px; letter-spacing: .03em; white-space: nowrap; }
  .site-nav__link.is-active { background: var(--nav-active-bg); }
  .site-nav__user { gap: 12px; }
  .site-nav__name { display: none; }
  /* Ссылка «Профиль» дублирует аватар (он ведёт в профиль), поэтому на десктопе скрыта вместе с разделителем */
  .site-nav__minor--profile, .site-nav__sep { display: none; }
  .site-nav__minor-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

/* 1100–1279px: ещё плотнее — кегль 11px, минимальные отступы */
@media (min-width: 1100px) and (max-width: 1279px) {
  .site-header__inner { gap: 14px; }
  .site-nav { gap: 6px; }
  .site-nav__link { padding: 0 4px; font-size: 11px; letter-spacing: .02em; }
}

@media (max-width: 1099px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: var(--header-h);
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-pop);
  }
  .site-nav.is-open { display: flex; }
  .site-nav--guest {
    display: flex; position: static; flex-direction: row; justify-content: flex-end;
    background: none; border: 0; box-shadow: none; margin-left: auto;
  }
  .site-nav__list { flex-direction: column; height: auto; padding: 8px 0; }
  .site-nav__link { height: 46px; padding: 0 24px; border-bottom: 0; border-left: 2px solid transparent; }
  .site-nav__link.is-active { border-left-color: var(--accent-text); background: var(--bg-elev-2); }
  .site-nav__user {
    margin-left: 0;
    height: auto;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
  }
}

/* --------------------------------------------------------------------------
   Подвал
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  margin-top: auto;
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding-top: 18px;
  padding-bottom: 18px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Кнопки
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--bg-elev-3); border-color: var(--text-dim); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); border-color: var(--accent-edge); color: var(--accent-ink); box-shadow: var(--btn-primary-shadow); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover-edge); color: var(--accent-ink); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-elev-2); border-color: transparent; color: var(--text); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 11px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   Формы
   -------------------------------------------------------------------------- */
.form { max-width: 720px; }
.form--narrow { max-width: 480px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
/* Подпись поля; label.check — строка с чекбоксом, у неё свой стиль (.check ниже) */
.field > label:not(.check),
.label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.field > label .req { color: var(--accent-text); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--field-border-hover); }
.input:focus, .select:focus, .textarea:focus,
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none;
  border-color: var(--field-focus);
  background-color: var(--field-bg);
  box-shadow: var(--field-focus-ring);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }

.textarea { height: auto; min-height: 160px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.textarea--tall { min-height: 320px; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select option { background: var(--field-bg); color: var(--text); }

/* Календарь и часы в полях date/time — в цветах темы: color-scheme наследуется от <html> */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }

input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--control-accent);
  flex-shrink: 0;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.check input:disabled + span { color: var(--text-dim); }

.field-error { font-size: 13px; color: var(--danger); }
.field-hint { font-size: 13px; color: var(--text-muted); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 16px;
}
.form-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) {
  .form-row--2, .form-row--3 { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.form-actions .spacer { flex: 1; }

.form-errors {
  border-left: 3px solid var(--danger);
  background: var(--bg-elev);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text);
}

.search-field { position: relative; }
.search-field .icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-field .input { padding-left: 38px; }

.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.filters .field { margin-bottom: 0; flex: 1 1 220px; }
.filters .field--narrow { flex: 0 1 280px; }
.filters .filters__actions { display: flex; gap: 8px; align-items: center; height: 40px; }

/* Сегментированный переключатель */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-decoration: none;
  border-right: 1px solid var(--line-strong);
  transition: background-color .15s, color .15s;
}
.seg a:last-child { border-right: 0; }
.seg a:hover { color: var(--text); background: var(--bg-elev-2); }
.seg a.is-active { color: var(--text); background: var(--bg-elev-3); box-shadow: inset 0 -2px 0 var(--accent-text); }

.toolbar {
  display: flex;
  gap: 12px 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   Карточки
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.card-title .icon { width: 16px; height: 16px; color: var(--accent-text); }
/* Иконка заголовка карточки — в мятной плашке (§39); отрицательные поля — высота строки заголовка не меняется */
.card-title > span:first-child > .icon {
  width: 24px; height: 24px; padding: 4px; margin: -3px 0;
  border-radius: var(--radius);
  background: var(--chip-bg);
  color: var(--accent-text);
}
.card-title__note { font-weight: 400; letter-spacing: .04em; text-transform: none; font-size: 12px; }
.card-body { min-width: 0; }

.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 16px; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.two-col--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col > .card { margin: 0; }
@media (max-width: 899px) {
  .two-col, .two-col--even { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Таблицы
   -------------------------------------------------------------------------- */
/* position: relative — чтобы абсолютно позиционированные потомки (.sr-only в заголовках)
   не выходили за прокручиваемую область и не расширяли страницу */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg-elev-2); }
.table tr.is-muted td { color: var(--text-dim); }
.table tr.is-muted .avatar { opacity: .5; }
.table .cell-person { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.table .cell-person a { text-decoration: none; font-weight: 600; white-space: nowrap; }
.table .cell-person a:hover { text-decoration: underline; }
.table .cell-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.table .cell-actions { text-align: right; white-space: nowrap; }
.table .cell-actions .btn { vertical-align: middle; }

/* --------------------------------------------------------------------------
   Бейджи, флеш, пустые состояния
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: middle;
}
.badge-now { background: var(--accent); border-color: var(--accent-edge); color: var(--accent-ink); }
.badge-past { color: var(--text-dim); border-color: var(--line); }
.badge-admin { color: var(--accent-text); border-color: var(--accent-text); }
.badge-inactive { color: var(--danger); border-color: var(--danger); }
.badge-pinned { background: var(--pinned-bg); color: var(--pinned-fg); border-color: var(--pinned-border); }
.badge-you { color: var(--text-muted); border-color: var(--line-strong); }

.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius);
  font-size: 14px;
}
.flash.success { border-left-color: var(--ok); }
.flash.error { border-left-color: var(--danger); }
.flash__text { flex: 1; }
.flash__close {
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  margin: -2px -4px 0 0;
}
.flash__close:hover { color: var(--text); }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.empty--tall { padding: 56px 16px; }

/* --------------------------------------------------------------------------
   Аватар
   -------------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  flex-shrink: 0;
  user-select: none;
  /* Светлая тема: тонкое кольцо, чтобы светлые цвета палитры («Бетон», «Жёлтый ERKON») не сливались с белой карточкой */
  box-shadow: inset 0 0 0 1px var(--avatar-ring);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }
.avatar-xl { width: 112px; height: 112px; font-size: 36px; }
/* Тёмная тема без жёлтого (§39): жёлто-оливковый цвет круга (avatar_color, тон 35–75°) partials/avatar.ejs
   и public/js/dashboard.js помечают классом avatar--warm и кладут в --avatar-dark-bg изумрудный того же тона
   светлоты, а в --avatar-dark-ink — цвет инициалов по контрасту с ним. Цвет круга задан во встроенном style,
   поэтому перекрывается только с !important. В светлой теме и в базе цвет прежний. */
@media screen {
  :root[data-theme="dark"] .avatar--warm {
    background: var(--avatar-dark-bg) !important;
    color: var(--avatar-dark-ink) !important;
  }
}
/* Фото профиля (§20) — в том же круге, что и инициалы */
.avatar.has-photo { overflow: hidden; }
.avatar-img { width: 100%; height: 100%; max-width: none; object-fit: cover; border-radius: 50%; display: block; }

/* --------------------------------------------------------------------------
   Дашборд
   -------------------------------------------------------------------------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.dash-grid > .card { margin: 0; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
/* 900–1099px: узкие карточки первого и последнего рядов перестраиваются по классам md-* — шаблон дашборда
   расставляет их сам, в зависимости от набора включённых разделов (§34); остальные ряды не меняются */
@media (min-width: 900px) and (max-width: 1099px) {
  .md-5 { grid-column: span 5; }
  .md-6 { grid-column: span 6; }
  .md-7 { grid-column: span 7; }
  .md-12 { grid-column: span 12; }
}
@media (max-width: 899px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-12 { grid-column: auto; }
}

/* Сегодня */
.today { display: flex; flex-direction: column; height: 100%; min-height: 220px; }
.today__weekday {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}
.today__date {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 64px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .01em;
  margin: 8px 0 6px;
  color: var(--text);
}
.today__date .today__month { font-weight: 400; color: var(--text-muted); }
.today__year { font-size: 13px; letter-spacing: .1em; color: var(--text-dim); }
.today__clock {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 52px;
  line-height: 1;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  margin-top: auto;
  padding-top: 20px;
  color: var(--text);
}
.today__meta {
  display: flex;
  gap: 6px 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.today__meta b { color: var(--text-muted); font-weight: 600; }

/* Карточка «Сегодня» — глубокий изумруд с белым текстом (§39). Цвета текста, линий и плашки иконки
   переопределены для карточки, поэтому общие правила (.today__*, .card-title) работают без изменений */
.dash-today {
  --text: var(--today-text);
  --text-muted: var(--today-text-muted);
  --text-dim: var(--today-text-dim);
  --text-hover: var(--today-text);
  --line: var(--today-line);
  --accent-text: var(--today-accent);
  --chip-bg: var(--today-chip);
  --focus-ring: var(--today-accent);
  color: var(--text);
  background: var(--today-bg);
  border-color: var(--today-border);
  box-shadow: var(--today-shadow);
}

/* Погода */
.weather-main {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.weather-icon { color: var(--accent-text); }
.weather-icon .icon { width: 64px; height: 64px; stroke-width: 1.25; }
.weather-temp {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 72px;
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.weather-temp__unit { font-size: 28px; font-weight: 400; color: var(--text-muted); margin-left: 2px; vertical-align: top; line-height: 1.2; }
.weather-desc { min-width: 0; flex: 1; }
.weather-city { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.weather-text { font-size: 19px; font-weight: 500; margin-top: 2px; }
.weather-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.weather-meta span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.weather-meta .icon { width: 15px; height: 15px; color: var(--text-dim); }

.weather-days {
  list-style: none;
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.weather-day { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.weather-day__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.weather-day .icon { width: 26px; height: 26px; color: var(--text-muted); }
.weather-day__range {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.weather-day__range span { color: var(--text-dim); margin-left: 4px; }
.weather-note { margin-top: 12px; font-size: 12px; color: var(--text-muted); letter-spacing: .02em; }

@media (max-width: 480px) {
  .card-title__note { display: none; }
  .weather-temp { font-size: 56px; }
  .weather-days { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Совещания (список) */
.meeting-list { list-style: none; margin: 0; padding: 0; }
.meeting-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.meeting-row:first-child { padding-top: 0; }
.meeting-row:last-child { border-bottom: 0; padding-bottom: 0; }
/* Прошедшее совещание приглушается цветом, а не opacity: контраст текста остаётся ≥ 4.5:1 */
.meeting-row.is-past .meeting-time,
.meeting-row.is-past .meeting-title a { color: var(--text-muted); }
.meeting-row.is-past .meeting-title a:hover { color: var(--text); }
.meeting-row.is-now .meeting-time { color: var(--accent-text); }
.meeting-time {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meeting-info { min-width: 0; }
.meeting-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.meeting-title a { text-decoration: none; }
.meeting-title a:hover { text-decoration: underline; }
.meeting-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-muted);
}
.meeting-meta > span { display: inline-flex; align-items: center; gap: 4px; }
/* Разделитель стоит в конце элемента: при переносе строки точка остаётся на предыдущей */
.meeting-meta > span:not(:last-child)::after { content: "·"; margin: 0 8px 0 4px; color: var(--text-dim); }
.meeting-meta .icon { width: 14px; height: 14px; color: var(--text-dim); }
.meeting-status { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
@media (max-width: 600px) {
  .meeting-row { grid-template-columns: minmax(0, 1fr) auto; }
  .meeting-time { grid-column: 1 / -1; font-size: 20px; }
}

/* Группы по датам (страница совещаний) */
.day-group { margin-bottom: 28px; }
.day-group__label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
}
.day-group__rel {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
}
.day-group__label.is-today .day-group__rel { color: var(--accent-text); }
.day-group__date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.day-group .meeting-row { padding: 14px 0; }
.day-group .meeting-row:first-child { padding-top: 14px; }
.day-group .meeting-row:last-child { padding-bottom: 14px; border-bottom: 1px solid var(--line); }

/* Дни рождения */
.bday-group { margin-bottom: 18px; }
.bday-group:last-child { margin-bottom: 0; }
.bday-group__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.bday-group.is-today .bday-group__label { color: var(--accent-text); border-bottom-color: var(--line-strong); }
.bday-group__label .icon { width: 16px; height: 16px; }
.bday-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.bday-row:last-child { border-bottom: 0; padding-bottom: 0; }
.bday-row__info { min-width: 0; flex: 1; }
.bday-row__name { font-weight: 600; text-decoration: none; display: block; }
.bday-row__name:hover { text-decoration: underline; }
.bday-row__pos { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bday-row__age {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent-text);
  white-space: nowrap;
  text-align: right;
}

/* Новости */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: 0; padding-bottom: 0; }
.news-item__title { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 0 0 6px; }
.news-item__title a { text-decoration: none; }
.news-item__title a:hover { text-decoration: underline; }
.news-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.news-item__excerpt { margin: 8px 0 0; font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.news-page .news-item { padding: 24px 0; }
.news-page .news-item:first-child { padding-top: 0; }
.news-page .news-item__title { font-size: 20px; }

.article-head { margin-bottom: 24px; }
.article-head .page-title { margin-top: 8px; }
.article-head .news-item__meta { margin-top: 12px; }
.article-body { max-width: 760px; font-size: 16px; }

/* Быстрые ссылки и цифры */
.quick-links {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.quick-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.quick-links a:hover { color: var(--text); background: var(--chip-bg); border-color: var(--accent); }
.quick-links .icon { width: 18px; height: 18px; color: var(--accent-text); }
.quick-links a::after { content: "→"; margin-left: auto; color: var(--text-dim); }
.quick-links a:hover::after { color: var(--accent-text); }

.figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.figure { min-width: 0; }
/* Размер зависит от ширины окна, а перенос разрешён: «МКАД + 10 км» не должен выходить за карточку */
.figure__value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--accent-text);
  overflow-wrap: anywhere;
}
.figure__label {
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Сотрудники
   -------------------------------------------------------------------------- */
.dept-section { margin-bottom: 32px; }
.dept-section__label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}
.dept-section__label .count { font-weight: 400; letter-spacing: .04em; color: var(--text-dim); }

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 12px;
}
.person-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  transition: border-color .15s;
}
.person-card:hover { border-color: var(--line-strong); }
.person-card__body { min-width: 0; flex: 1; }
.person-card__name { font-weight: 600; text-decoration: none; display: block; line-height: 1.3; }
.person-card__name:hover { text-decoration: underline; }
.person-card__pos { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.person-card__contacts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.person-card__contacts a { color: var(--text-muted); text-decoration: none; }
.person-card__contacts a:hover { color: var(--text); text-decoration: underline; }
.person-card__contacts .ext { color: var(--text); font-weight: 500; }

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.profile-head__body { flex: 1; min-width: 200px; }
.profile-head__badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 24px;
  font-size: 14px;
}
.dl dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding-top: 3px;
}
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dl dd a { text-decoration: none; }
.dl dd a:hover { text-decoration: underline; }
@media (max-width: 480px) {
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
}

.people-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.people-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.people-list li:first-child { padding-top: 0; }
.people-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.people-list__body { min-width: 0; flex: 1; }
.people-list__name { text-decoration: none; font-weight: 500; display: block; }
.people-list__name:hover { text-decoration: underline; }
.people-list__pos { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Компактный список совещаний (профиль сотрудника) */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 2px 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.mini-list li:first-child { padding-top: 0; }
.mini-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-list__when {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  padding-top: 3px;
}
.mini-list__when b {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: .03em;
  color: var(--text);
  text-transform: none;
  margin-top: 2px;
}
.mini-list__title a { text-decoration: none; font-weight: 600; }
.mini-list__title a:hover { text-decoration: underline; }
.mini-list__sub { font-size: 13px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Совещание — детали и форма
   -------------------------------------------------------------------------- */
.detail-time {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.detail-time__value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
.detail-time__date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.detail-time.is-now .detail-time__value { color: var(--accent-text); }
.detail-time.is-past .detail-time__value { color: var(--text-dim); }

.picker {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
}
.picker__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.picker__head .search-field { flex: 1; }
.picker__head .input { background: var(--bg-elev); height: 36px; }
.picker__count { font-size: 12px; color: var(--text-muted); white-space: nowrap; letter-spacing: .02em; }
.picker__list { max-height: 340px; overflow-y: auto; padding: 6px 0; }
.picker__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 14px;
}
.picker__item:hover { background: var(--bg-elev-3); }
.picker__item.is-organizer { cursor: default; }
.picker__item .avatar-sm { font-size: 10px; }
.picker__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.picker__name { line-height: 1.3; }
.picker__pos { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker__tag { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); white-space: nowrap; }
.picker__empty { padding: 18px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Логин
   -------------------------------------------------------------------------- */
body.login-page {
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 36px 32px 32px; border-top: 2px solid var(--accent-line); }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 28px; }
.login-brand .logo-img { height: 40px; }
.login-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 18px;
}
.login-card .btn-block { margin-top: 6px; height: 42px; font-size: 13px; }
.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.login-copy {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Страница ошибки
   -------------------------------------------------------------------------- */
.error-page { text-align: center; padding: 56px 0 40px; }
.error-status {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 128px;
  line-height: 1;
  letter-spacing: .04em;
  color: var(--text);
}
.error-status::after {
  content: "";
  display: block;
  width: 48px; height: 3px;
  margin: 16px auto 0;
  background: var(--accent-line);
}
.error-message { font-size: 20px; font-weight: 500; color: var(--text); margin: 20px 0 8px; }
.error-hint { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.error-page .form-actions { justify-content: center; }

/* --------------------------------------------------------------------------
   Прочее
   -------------------------------------------------------------------------- */
.color-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  vertical-align: -2px;
  margin-right: 6px;
}
.inline-form { display: inline; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 600px) {
  .container { padding-left: 16px; padding-right: 16px; }
  main.container { padding-top: 20px; padding-bottom: 40px; }
  .page-title { font-size: 28px; }
  .card { padding: 16px; }
  .today__date { font-size: 52px; }
  .today__clock { font-size: 44px; }
  .error-status { font-size: 96px; }
}

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

/* ==========================================================================
   v2 — приветствие, дежурный 1С, отсутствия, телефонная книга, календарь ДР,
   график дежурств, галерея, загрузка файлов. Только токены §7.1, без новых цветов.
   ========================================================================== */

/* Приветствие над сеткой дашборда (§21) */
.greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.greeting__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: .02em;
  color: var(--text);
}
.greeting__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.greeting__summary > span { white-space: nowrap; }
.greeting__summary > span:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--text-dim); }
.greeting__summary b { color: var(--text); font-weight: 600; }
.greeting__summary a { color: var(--accent-text); text-decoration: none; }
.greeting__summary a:hover { text-decoration: underline; }
@media (max-width: 600px) { .greeting__title { font-size: 24px; } }

/* Дежурный службы 1С (§16) */
.duty { display: flex; flex-direction: column; gap: 10px; }
/* Высота выравнивает карточку с соседями в ряду; в одну колонку (телефон, планшет) пустой зазор не нужен */
@media (min-width: 1100px) { .duty { min-height: 180px; } }
.duty__person { display: flex; align-items: center; gap: 12px; }
.duty__who { min-width: 0; }
.duty__name { font-weight: 600; text-decoration: none; display: block; line-height: 1.3; overflow-wrap: anywhere; }
.duty__name:hover { text-decoration: underline; }
.duty__pos { font-size: 12px; color: var(--text-muted); }
.duty__phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.1;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.duty__phone .icon { flex-shrink: 0; }
.duty__phone .icon { width: 20px; height: 20px; color: var(--accent-text); }
@media (max-width: 899px) { .duty__phone { font-size: 30px; } }
.duty__phone:hover { color: var(--text-hover); }
.duty__note { font-size: 13px; color: var(--text-muted); border-left: 2px solid var(--line-strong); padding-left: 10px; }
.duty .empty { padding: 18px 8px; }
.duty .empty a { color: var(--text); }
.duty__tomorrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.duty__tomorrow b { color: var(--text-muted); font-weight: 600; }
.duty__tomorrow a { color: var(--text-muted); text-decoration: none; }
.duty__tomorrow a:hover { color: var(--text); text-decoration: underline; }

/* Отсутствия: список на дашборде и на странице */
.absence-list { list-style: none; margin: 0; padding: 0; }
.absence-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.absence-row:last-child { border-bottom: 0; padding-bottom: 0; }
.absence-row__info { min-width: 0; flex: 1; }
.absence-row__name { font-weight: 600; text-decoration: none; display: block; line-height: 1.3; }
.absence-row__name:hover { text-decoration: underline; }
.absence-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 3px; font-size: 13px; color: var(--text-muted); }
.absence-row__until { text-align: right; white-space: nowrap; font-size: 13px; color: var(--text); font-weight: 600; }
.absence-row__until small { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.absence-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 600px) {
  .absence-row { flex-wrap: wrap; }
  .absence-row__until { text-align: left; }
  .absence-row__actions { width: 100%; justify-content: flex-end; }
}

/* Бейджи v2: виды отсутствий, роли, категории новостей, обложка, выходной */
.badge-vacation { color: var(--text); border-color: var(--line-strong); }
.badge-sick { color: var(--warn); border-color: var(--warn); }
.badge-trip { color: var(--ok); border-color: var(--ok); }
/* Роли (§23): администратор — контур акцентом, офис-менеджер — светлый контур, сотрудник — приглушённо */
.badge-role-admin { color: var(--accent-text); border-color: var(--accent-text); }
.badge-role-office { color: var(--text); border-color: var(--text-muted); }
.badge-role-user { color: var(--text-dim); border-color: var(--line); }
.badge-cat { color: var(--text-muted); border-color: var(--line-strong); }
.badge-cover { background: var(--accent); border-color: var(--accent-edge); color: var(--accent-ink); }
.badge-weekend { color: var(--text-dim); border-color: var(--line); }
.badge-absent { color: var(--warn); border-color: var(--warn); }

/* Запасной список «Следующие: …» в виджете дней рождения (§17а) */
.bday-next { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-muted); }
.bday-next__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 6px; }
.bday-next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.bday-next__when { color: var(--text); font-weight: 600; }
.bday-next a { color: var(--text); text-decoration: none; }
.bday-next a:hover { text-decoration: underline; }
.bday-row__age.is-unknown { color: var(--text-dim); }

/* Примечание под заголовком страницы (галерея, пользователи) и описание альбома */
.page-note {
  margin: -8px 0 20px;
  padding: 6px 12px;
  border-left: 2px solid var(--line-strong);
  font-size: 13px;
  color: var(--text-muted);
  max-width: 900px;
}
.album-desc { max-width: 760px; margin-bottom: 20px; color: var(--text-muted); }

/* Быстрый поиск по телефонной книге на дашборде */
.dash-search { display: flex; gap: 8px; }
.dash-search .search-field { flex: 1; min-width: 0; }

/* «Ближайшие» в шапке календаря дней рождений */
.next-up { font-size: 13px; color: var(--text-muted); max-width: 560px; }
.next-up__label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.next-up__label .icon { width: 14px; height: 14px; color: var(--accent-text); }
.next-up ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.next-up__when { color: var(--text); font-weight: 600; }
.next-up a { color: var(--text); text-decoration: none; }
.next-up a:hover { text-decoration: underline; }

/* Ключевые номера на дашборде */
.key-phones { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.key-phones li { display: flex; align-items: center; gap: 12px; font-size: 13px; min-width: 0; }
.key-phones__who { min-width: 0; flex: 1; }
.key-phones__name { display: block; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-phones__name:hover { text-decoration: underline; }
.key-phones__pos { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-phones__ext {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
  text-decoration: none;
  white-space: nowrap;
}
.key-phones__ext:hover { color: var(--accent-text-hover); }
.key-phones__ext small { font-family: var(--font); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-right: 5px; }

/* Мини-галерея на дашборде */
.album-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.album-mini a { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.album-mini a:hover .album-mini__title { text-decoration: underline; }
.album-mini__cover {
  width: 84px; height: 54px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  overflow: hidden;
}
.album-mini__cover img { width: 100%; height: 100%; object-fit: cover; }
.album-mini__body { min-width: 0; }
.album-mini__title { font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-mini__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Телефонная книга: сгруппированная таблица */
.table .table-group th {
  padding: 22px 12px 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line-strong);
}
.table tbody:first-of-type .table-group th { padding-top: 6px; }
.table .table-group .count { font-weight: 400; color: var(--text-dim); margin-left: 6px; }
.table .cell-ext { white-space: nowrap; }
.table .cell-ext a, .table .cell-ext span {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.table .cell-ext a:hover { text-decoration: underline; }
.table .cell-phone { white-space: nowrap; }
.table .cell-phone a { text-decoration: none; }
.table .cell-phone a:hover { text-decoration: underline; }
.table .cell-mail a { color: var(--text-muted); text-decoration: none; overflow-wrap: anywhere; }
.table .cell-mail a:hover { color: var(--text); text-decoration: underline; }
.print-head { display: none; }

/* Календарь дней рождений (§17а) */
.months-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.months-grid > .card { margin: 0; }
@media (max-width: 1099px) { .months-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .months-grid { grid-template-columns: 1fr; } }
.month-card { display: flex; flex-direction: column; }
.month-card.is-current { border-top: 2px solid var(--accent-line); border-color: var(--line-strong); border-top-color: var(--accent-line); }
.month-card__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.month-card.is-current .month-card__title { color: var(--accent-text); }
.month-card__count { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--text-dim); text-transform: uppercase; white-space: nowrap; }
.month-card .empty { padding: 18px 8px; }
.month-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.month-row:last-child { border-bottom: 0; }
.month-row__day {
  width: 34px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.month-row__info { min-width: 0; flex: 1; }
.month-row__name { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none; }
.month-row__name:hover { text-decoration: underline; }
.month-row__pos { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-row .icon-cake { width: 16px; height: 16px; color: var(--accent-text); flex-shrink: 0; }
.month-row.is-today .month-row__day { color: var(--accent-text); }
.month-row.is-past .month-row__day { color: var(--text-dim); }
.month-row.is-past .month-row__name { color: var(--text-muted); }
.month-row.is-past .avatar { opacity: .6; }

/* Переключатель месяца (график дежурств) */
.month-nav { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.month-nav a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px;
  color: var(--text-muted);
  text-decoration: none;
}
.month-nav a:hover { color: var(--text); background: var(--bg-elev-2); }
.month-nav a .icon { width: 18px; height: 18px; }
.month-nav__label {
  min-width: 170px;
  padding: 0 8px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-left: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  line-height: 34px;
}

/* График дежурств */
.duty-table td { padding: 10px 12px; }
.duty-table .cell-date { white-space: nowrap; width: 128px; }
.duty-table .cell-date b {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
  color: var(--text);
}
/* Подпись дня недели; бейджи «Сегодня»/«Вых.» рядом — со своими цветами (иначе серый текст на изумрудной заливке) */
.duty-table .cell-date span:not(.badge) { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.duty-table .cell-empty { color: var(--text-dim); font-size: 13px; }
.duty-table tr.is-weekend td { background: var(--row-tint); }
.duty-table tr.is-weekend .cell-date b { color: var(--text-muted); }
.duty-table tr.is-past .cell-date b { color: var(--text-dim); }
.duty-table tr.is-today td { background: var(--bg-elev-2); }
.duty-table tr.is-today td:first-child { box-shadow: inset 3px 0 0 var(--accent-line); }
.duty-table tr.is-today .cell-date b { color: var(--accent-text); }
.duty-form .form-row { grid-template-columns: 170px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 899px) { .duty-form .form-row { grid-template-columns: 1fr; } }

/* Галерея: альбомы */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.album-card {
  display: block;
  text-decoration: none;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.album-card:hover { border-color: var(--line-strong); }
.album-card__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  overflow: hidden;
}
.album-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.album-card:hover .album-card__cover img { transform: scale(1.03); }
.album-card__cover > .icon { width: 40px; height: 40px; stroke-width: 1.25; }
.album-card__plate {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 36px 14px 12px;
  background: var(--plate-bg);
}
.album-card__title { font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--text); }
.album-card__meta { display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.album-card__meta > span:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--text-dim); }

/* Галерея: фото альбома */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-tile {
  margin: 0;
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo-tile.is-cover { border-color: var(--accent-line); }
.photo-tile__link { display: block; aspect-ratio: 4 / 3; background: var(--bg-elev-3); }
.photo-tile__link img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.photo-tile:hover .photo-tile__link img { transform: scale(1.03); }
.photo-tile__badge { position: absolute; top: 8px; left: 8px; z-index: 1; }
.photo-tile__caption { padding: 8px 10px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-tile__actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); margin-top: auto; }
.photo-tile__actions form { flex: 1; display: flex; }
.photo-tile__actions .btn { flex: 1; padding: 0 6px; }
@media (max-width: 600px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

/* Лайтбокс (public/js/gallery.js) */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 64px 80px 72px;
  background: var(--lightbox-bg);
}
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; background: var(--bg-elev); box-shadow: var(--lightbox-shadow); }
.lightbox__btn {
  position: absolute;
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--tint);
  color: var(--text);
  cursor: pointer;
}
.lightbox__btn:hover { background: var(--tint-strong); color: var(--text-hover); }
.lightbox__btn .icon { width: 24px; height: 24px; }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox__foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.lightbox__caption { min-width: 0; flex: 1; color: var(--text); overflow-wrap: anywhere; }
.lightbox__counter { font-family: var(--font-display); font-size: 18px; letter-spacing: .06em; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.lightbox-open { overflow: hidden; }
@media (max-width: 600px) {
  .lightbox { padding: 60px 8px 72px; }
  .lightbox__btn { width: 40px; height: 40px; }
  .lightbox__prev { left: 6px; }
  .lightbox__next { right: 6px; }
}

/* Поле выбора файла — в цветах поля ввода, кнопка в стиле .btn */
.input-file {
  display: block;
  width: 100%;
  padding: 7px 8px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}
.input-file::file-selector-button {
  margin-right: 12px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev-3);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}
.input-file:hover { border-color: var(--field-border-hover); }
.input-file:focus-visible { outline: none; border-color: var(--field-focus); box-shadow: var(--field-focus-ring); }

/* Зона загрузки фото (drag-and-drop) и предпросмотр */
.upload-zone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  padding: 26px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: border-color .15s, background-color .15s;
}
.upload-zone.is-dragover { border-color: var(--accent-line); background: var(--bg-elev-3); }
.upload-zone > .icon { display: block; width: 32px; height: 32px; margin: 0 auto 10px; color: var(--accent-text); stroke-width: 1.5; }
.upload-zone__hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.upload-zone .input-file { max-width: 440px; margin: 14px auto 0; text-align: left; background: var(--bg-elev); }
.upload-previews { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.upload-previews li { background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.upload-previews img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.upload-previews__name { padding: 6px 8px 0; font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-previews .input { height: 32px; padding: 0 8px; font-size: 13px; background: transparent; border-color: transparent; }
.upload-previews .input:focus { background: var(--bg-elev); border-color: var(--field-focus); }
.upload-status { margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.upload-status.is-error { color: var(--danger); }

/* Фото профиля (§20) */
.avatar-upload { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.avatar-upload__preview { flex-shrink: 0; }
.avatar-upload__form { flex: 1; min-width: 220px; }
.avatar-upload__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* Список дежурств в карточке сотрудника */
.mini-list__when .badge { margin-top: 4px; }

/* ==========================================================================
   v3 — роли и доступ к контактам, админка (пользователи, контакты служб),
   телефонная книга по правам, дашборд без мобильных. Только токены §7.1.
   ========================================================================== */

/* Вкладки администрирования (admin/_tabs.ejs) */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin: -8px 0 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.admin-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 11px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a.is-active { color: var(--text); border-bottom-color: var(--accent-text); }
.admin-tabs .icon { width: 16px; height: 16px; color: var(--text-dim); }
.admin-tabs a.is-active .icon { color: var(--accent-text); }

/* Сводка по ролям в списке пользователей: плитки-фильтры («Все роли», три роли и «Без дня рождения», §32) */
.role-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 899px) { .role-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.role-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  transition: border-color .15s;
}
.role-stat:hover { border-color: var(--line-strong); color: var(--text); }
.role-stat.is-active { border-color: var(--line-strong); box-shadow: inset 0 -2px 0 var(--accent-text); }
.role-stat__value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.role-stat__label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }

/* Фильтры списка пользователей: поиск + пять списков (роль, отдел, площадка, статус, день рождения) в одну строку на 1280px */
.filters--compact .field { flex-basis: 200px; }
.filters--compact .field--narrow { flex: 1 1 140px; max-width: 220px; }
@media (max-width: 600px) { .filters--compact .field--narrow { max-width: none; } }

/* Список пользователей: роль с быстрой сменой, действия */
.select-sm { height: 30px; width: auto; min-width: 0; padding: 0 30px 0 8px; font-size: 13px; background-position: right 7px center; }
.role-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* Кнопка «Сменить» с подписью; в узкой колонке уходит под список ролей, чтобы таблица помещалась на 1280 px */
.role-quick { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.role-quick .btn-sm { padding: 0 8px; }
.actions-row--end { justify-content: flex-end; gap: 6px; }
/* Действия в строке списка пользователей — столбик кнопок одинаковой ширины */
.actions-stack { display: inline-flex; flex-direction: column; align-items: stretch; gap: 6px; }
.actions-stack .btn { width: 100%; justify-content: flex-start; }
.actions-stack .inline-form { display: block; }
.users-table td { vertical-align: top; }
.users-table .cell-contacts { font-size: 13px; color: var(--text-muted); min-width: 170px; }
.users-table .cell-contacts a { color: var(--text-muted); text-decoration: none; }
.users-table .cell-contacts a:hover { color: var(--text); text-decoration: underline; }
.users-table .cell-contacts b { color: var(--text); font-weight: 600; }

/* Роль в форме пользователя — радиокарточки с описанием прав */
.role-fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.role-fieldset > legend { width: 100%; padding: 0; }
.role-fieldset > .field-hint, .role-fieldset > .field-error { margin-top: 8px; }
.role-cards { display: grid; gap: 8px; }
.role-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.role-card:hover { border-color: var(--line-strong); }
.role-card input { margin-top: 2px; }
.role-card.is-checked, .role-card:has(input:checked) { border-color: var(--accent-line); background: var(--bg-elev-3); }
.role-card.is-disabled { cursor: not-allowed; }
.role-card.is-disabled:not(.is-checked) { opacity: .55; }
.role-card__body { min-width: 0; flex: 1; }
.role-card__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; line-height: 1.3; }
.role-card__desc { margin-top: 3px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }

/* Пароль: блок в форме и одноразовый показ сгенерированного пароля во flash */
.password-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.password-block .check { margin-bottom: 14px; }
.password-generate { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.password-generate .field-hint { flex: 1; min-width: 200px; }
.flash__body { flex: 1; min-width: 0; }
.flash-secret { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.flash-secret__value {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-elev-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: .08em;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}
.flash-secret .btn.is-done { border-color: var(--ok); color: var(--ok); }
.flash-secret__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.flash-secret__login {
  display: inline-block;
  padding: 6px 12px;
  margin-right: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}
.flash-secret__note { display: block; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.flash-secret__status { font-size: 12px; color: var(--text-muted); }

/* Телефонная книга v3: службы, несколько мобильных, подпись о правах */
.phone-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.phone-list a { text-decoration: none; white-space: nowrap; }
.phone-list a:hover { text-decoration: underline; }
.table .cell-site { white-space: nowrap; font-size: 13px; color: var(--text-muted); }
.table.phonebook .cell-mail a { white-space: nowrap; overflow-wrap: normal; }
.table .cell-alt { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.table .table-group--services th { color: var(--text); }
.table .table-group--services .icon { width: 14px; height: 14px; color: var(--accent-text); vertical-align: -2px; margin-right: 6px; }
.service-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  background: var(--bg-elev-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.service-mark .icon { width: 18px; height: 18px; }
.table .cell-person .service-name { font-weight: 600; white-space: nowrap; }
/* Площадка в строке под именем и короткий заголовок «Доб.» — только на телефоне (см. медиазапрос ниже) */
.table .cell-sub__site, .table .th-short { display: none; }
@media (max-width: 640px) {
  /* Телефон: колонка «Площадка» уходит в строку под именем, имена переносятся, без аватаров —
     чтобы добавочный (единственный номер, который видит сотрудник) помещался на экран без прокрутки */
  .table.phonebook th, .table.phonebook td { padding-left: 8px; padding-right: 8px; }
  .table.phonebook th { letter-spacing: .04em; }
  .table.phonebook .table-group th { white-space: normal; }
  .table.phonebook .cell-person { min-width: 0; gap: 8px; }
  .table.phonebook .cell-person a, .table.phonebook .cell-person .service-name { white-space: normal; overflow-wrap: anywhere; }
  .table.phonebook .avatar, .table.phonebook .service-mark { display: none; }
  .table.phonebook thead th:nth-child(2), .table.phonebook td.cell-site { display: none; }
  .table.phonebook .cell-sub__site { display: inline; }
  .table.phonebook .th-full {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .table.phonebook .th-short { display: inline; }
  .table.phonebook .cell-ext { white-space: nowrap; }
}
.access-note { display: flex; align-items: center; gap: 8px; }
.access-note .icon { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }

/* Контакты сотрудника (карточка): несколько номеров, пометка о правах */
.dl dd .phone-list { gap: 4px; }
.dl dd.dim { color: var(--text-dim); }

/* Дашборд: дежурный — крупный добавочный; без добавочного — подсказка */
.duty__phone small {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.duty__phone--ext { font-size: clamp(30px, 2.8vw, 42px); letter-spacing: .04em; }
@media (max-width: 899px) { .duty__phone--ext { font-size: 40px; } }
.duty__noext {
  margin-top: auto;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
  font-size: 13px;
  color: var(--text-muted);
}
.duty__noext a { display: inline-block; margin-top: 4px; color: var(--text); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.duty__noext a:hover { text-decoration: underline; }
/* Дашборд: «Ключевые номера» — контакты служб, только добавочные */
.key-phones-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.key-phones-block .key-phones { margin: 0; padding: 0; border-top: 0; }
.key-phones__label { margin-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
span.key-phones__name { color: var(--text); }

/* Админка: контакты служб */
.contacts-table .cell-order { width: 1%; font-family: var(--font-display); font-size: 18px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.contacts-table td { vertical-align: top; }
.contacts-table .actions-row { flex-wrap: nowrap; }
/* Таблица должна помещаться в карточку на 1280 px: e-mail переносится, «Изменить» ниже 1400 px — только иконка */
.table.contacts-table .cell-mail a { white-space: normal; overflow-wrap: anywhere; }
.contacts-table .cell-person { min-width: 180px; }
@media (max-width: 1399px) {
  .contacts-table .btn-edit-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .btn, .flash__close { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #999; box-shadow: none; background: #fff; }
  /* Логотип на белой бумаге — оригинальные тёмные буквы */
  .logo-img { filter: none; }
  .print-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid #000;
  }
  .print-head .logo-img { height: 32px; }
  .print-head__title { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  .print-head__meta { font-size: 11px; color: #444; text-align: right; }
  body.phonebook-page main.container { padding-top: 0; }
  body.phonebook-page .page-head, body.phonebook-page .filters, body.phonebook-page .flash, body.phonebook-page .avatar { display: none !important; }
  body.phonebook-page .card { padding: 0; border: 0; }
  .table { font-size: 11px; color: #000; }
  .table th { color: #000; border-bottom-color: #000; padding: 6px 8px; }
  .table td { border-bottom-color: #bbb; padding: 5px 8px; color: #000; }
  .table .table-group th { background: #fff; color: #000; padding: 14px 8px 4px; border-bottom-color: #000; }
  .table .table-group .count { color: #444; }
  .table tbody tr:hover { background: transparent; }
  .table .cell-sub, .table .cell-mail a { color: #333; }
  .table .cell-ext a, .table .cell-ext span { font-size: 14px; }
  .table .cell-person { min-width: 0; }
  .table a, .table a:hover { color: #000; text-decoration: none; }
  .table .table-group { break-inside: avoid; }
  .table tr { break-inside: avoid; }
  /* v3: службы, площадка, другой вариант ФИО, подпись о правах */
  body.phonebook-page .service-mark { display: none !important; }
  body.phonebook-page .page-note { margin: 0 0 10px; color: #333; border-left-color: #999; }
  .access-note .icon { display: none; }
  .table .cell-site, .table .cell-alt { color: #333; }
  .table .table-group--services th, .table .table-group--services .icon { color: #000; }
  .phone-list a { white-space: nowrap; }
}

/* --------------------------------------------------------------------------
   v4: обязательная смена пароля (§31), дни рождения в админке (§32)
   -------------------------------------------------------------------------- */
/* Страница смены пароля — та же карточка, что у входа */
.password-lead { margin: -6px 0 16px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.password-account {
  display: flex;
  align-items: baseline;
  gap: 4px 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 9px 12px;
  background: var(--bg-elev-2);
  border-left: 2px solid var(--line-strong);
  font-size: 14px;
}
.password-account__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.password-account__name { min-width: 0; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.password-account__login { margin-left: 4px; font-weight: 400; color: var(--text-muted); }
.password-page .flash { margin-bottom: 18px; }
.password-logout { margin-top: 8px; }
.login-card .password-logout .btn-block { margin-top: 0; height: 36px; font-size: 12px; }

/* Требования к новому паролю: страница смены и профиль; выполненные отмечает public/js/app.js */
.password-rules {
  margin: -4px 0 18px;
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.password-rules__title { margin-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.password-rules__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.password-rules__list li { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.35; color: var(--text-muted); }
.password-rules__list .icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-dim); opacity: .45; transition: color .15s, opacity .15s; }
.password-rules__list li.is-ok { color: var(--text); }
.password-rules__list li.is-ok .icon { color: var(--ok); opacity: 1; }
.password-rules__note { margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--text-dim); }

/* Форма пользователя: временный пароль и незаполненный день рождения */
.password-note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.password-note .icon { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; color: var(--text-dim); }
.password-block .password-note { margin-bottom: 12px; }
.password-status { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: -4px 0 14px; font-size: 13px; color: var(--text-muted); }
/* Незаполненное и «Нет дня рождения» — цветом внимания (--attention, §39): янтарный в светлой теме, оранжевый в тёмной */
.input.is-missing:not([aria-invalid="true"]) { border-color: var(--attention); }
.field-hint--missing { color: var(--attention); font-weight: 600; }

/* Бейджи v4 */
.badge-nobday { color: var(--attention); border-color: var(--attention); }
.badge-pwchange { color: var(--text-muted); border-color: var(--text-dim); border-style: dashed; }

/* Порядок в списках (§41): узкое поле формы и бейдж «Первым в списках» в списке пользователей */
.input.input-priority { max-width: 160px; }
.badge-priority { color: var(--accent-text); border-color: var(--accent-line); }

/* Список пользователей: плитка «Без дня рождения», строки без даты с мини-формой, статус */
.role-stat--bday .role-stat__label .icon { width: 14px; height: 14px; color: var(--text-dim); }
.role-stat--bday.is-alert { border-color: var(--attention); }
.role-stat--bday.is-alert:hover { border-color: var(--attention-hover); }
.role-stat--bday.is-alert.is-active { box-shadow: inset 0 -2px 0 var(--attention); }
.role-stat--bday.is-alert .role-stat__label { color: var(--text); }
.role-stat--bday.is-alert .role-stat__label .icon { color: var(--attention); }
@media (max-width: 899px) { .role-stat--bday { grid-column: 1 / -1; } }
.page-note--accent { border-left-color: var(--attention-line); color: var(--text); }

.users-table tr.is-nobday > td:first-child { box-shadow: inset 3px 0 0 var(--attention-line); }
.users-table tr.is-nobday .cell-person { align-items: flex-start; }
.bday-quick { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 8px; }
.bday-quick__form { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.input.input-sm { height: 30px; padding: 0 8px; font-size: 13px; }
.bday-quick__form .bday-quick__dm { width: 64px; }
.bday-quick__form .bday-quick__year { width: 60px; }
.bday-quick__form .input:not(:placeholder-shown):invalid { border-color: var(--danger); }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* «Сменит пароль при входе» — в две строки: колонка статуса не расширяет таблицу на 1280px */
.users-table .status-cell { min-width: 128px; }
.status-cell .badge-pwchange { height: auto; min-height: 20px; padding: 3px 8px; line-height: 1.3; white-space: normal; }
@media print {
  .bday-quick__form { display: none; }
}

/* ==========================================================================
   v5 — неактивные разделы (§34) и мобильная версия (360–414 px).
   Только токены §7.1, без новых цветов.
   ========================================================================== */

/* Одноколоночные сетки-списки: колонка не шире контейнера, даже если внутри строка без переносов (nowrap + ellipsis) */
.key-phones, .album-mini, .quick-links, .bday-next ul, .next-up ul, .role-cards, .password-rules__list { grid-template-columns: minmax(0, 1fr); }

/* Шапка: выключенный раздел в меню администратора — приглушённо, с замком (title «Скрыт от сотрудников»).
   Подпись «Скрыт от сотрудников» видна только в мобильном меню, на десктопе — для скринридеров. */
.site-nav__link { gap: 5px; }
.site-nav__link.is-restricted { color: var(--text-dim); }
.site-nav__link.is-restricted:hover,
.site-nav__link.is-restricted.is-active { color: var(--text-muted); }
.site-nav__lock { width: 12px; height: 12px; color: var(--text-dim); }
.site-nav__note {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Десктоп: десять пунктов меню уже заполняют строку (§21) — замок стоит «надстрочным знаком» справа вверху
   и не прибавляет ширины пункту */
@media (min-width: 1100px) {
  .site-nav__link.is-restricted { position: relative; }
  .site-nav__link.is-restricted .site-nav__lock { position: absolute; top: 15px; right: -2px; width: 9px; height: 9px; }
}

/* Кнопка меню: «гамбургер» ↔ «крестик» по aria-expanded */
.nav-toggle__open, .nav-toggle__close { display: inline-flex; }
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: inline-flex; }
.nav-toggle[aria-expanded="true"] { border-color: var(--text-dim); background: var(--bg-elev-2); }

@media (max-width: 1099px) {
  /* Открытое меню не длиннее экрана: шапка липкая, поэтому меню прокручивается внутри себя */
  .site-nav {
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .site-nav__note {
    position: static; width: auto; height: auto; margin: 0 0 0 auto; padding-left: 12px;
    overflow: visible; clip: auto;
    font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--text-dim);
  }
  .site-nav__lock { width: 13px; height: 13px; }
  .site-nav__me, .site-nav__minor { min-height: 40px; }
  .site-nav__minor { padding: 0 6px; }
}

/* Дашборд: блок без пары во всю ширину и широкая карточка «Разделы» (§34) */
@media (min-width: 900px) {
  .dash-news.is-wide .news-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-news.is-wide .news-item { padding: 0 20px; border-bottom: 0; border-left: 1px solid var(--line); }
  .dash-news.is-wide .news-item:first-child { padding-left: 0; border-left: 0; }
  .dash-news.is-wide .news-item:last-child { padding-right: 0; }
  .dash-absences.is-wide .card-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 32px; }
  .dash-absences.is-wide .bday-group { margin-bottom: 0; }
}
@media (min-width: 600px) {
  .dash-links--grid .quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-links--grid .quick-links li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dash-links--grid .quick-links a { height: 100%; padding: 8px 10px; line-height: 1.25; }
}

/* Карточка сотрудника без боковых блоков (разделы совещаний и дежурств выключены) */
.person-solo { max-width: 880px; }

/* Раздел пока недоступен (section-disabled.ejs) */
.section-off {
  max-width: 640px;
  margin: 24px auto 0;
  padding: 32px;
  border-top: 2px solid var(--accent-line);
}
.section-off__mark {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  margin-bottom: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg-elev-2);
  color: var(--accent-text);
}
.section-off__mark .icon { width: 26px; height: 26px; }
.section-off__title {
  margin: 6px 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: .02em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.section-off__text { margin-bottom: 22px; font-size: 15px; line-height: 1.6; color: var(--text-muted); }
.section-off__label { margin-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.section-off__links { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 24px; }
.section-off__actions { margin-top: 0; }

/* Администрирование → Разделы */
.sections-table td { vertical-align: middle; }
.section-cell { display: flex; align-items: flex-start; gap: 12px; min-width: 280px; }
.section-cell__body { min-width: 0; }
.section-cell__name { font-weight: 600; text-decoration: none; }
.section-cell__name:hover { text-decoration: underline; }
.sections-table .cell-sub { max-width: 560px; margin-top: 4px; line-height: 1.45; }
.sections-table tr.is-on .service-mark { color: var(--accent-text); border-color: var(--line-strong); }
.sections-table tr.is-off .service-mark { color: var(--text-dim); border-style: dashed; }
.section-state { white-space: nowrap; }
.section-state .cell-sub { white-space: normal; margin-top: 6px; }
.badge .icon { width: 12px; height: 12px; margin-right: 5px; }
.badge-section-on { color: var(--ok); border-color: var(--ok); }
.badge-section-off { color: var(--text-muted); border-color: var(--line-strong); border-style: dashed; }
.page-note.sections-always { display: flex; align-items: flex-start; gap: 8px; margin: 20px 0 0; }
.sections-always .icon { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; color: var(--ok); }

/* --------------------------------------------------------------------------
   Мобильная версия: переносы длинных имён и адресов, поля ввода, области касания, таблицы
   -------------------------------------------------------------------------- */

/* Длинные ФИО, e-mail и заголовки переносятся в любом месте, а не расширяют страницу */
.greeting__title, .page-sub, .person-card__name, .person-card__contacts a, .person-card__contacts span,
.bday-row__name, .month-row__name, .absence-row__name, .people-list__name, .news-item__title,
.mini-list__title, .duty__name, .table .cell-sub, .error-message, .error-hint, .role-card__desc,
.password-account__login, .news-item__meta > span, .album-desc, .page-note { overflow-wrap: anywhere; }

/* Телефоны и планшеты (и любые сенсорные экраны): шрифт полей не меньше 16px — иначе iOS увеличивает страницу
   при фокусе; кнопки и поля не ниже 40px */
@media (max-width: 899px), (hover: none) and (pointer: coarse) {
  .input, .select, .textarea, .input-file { font-size: 16px; }
  .input.input-sm, .select.select-sm { height: 40px; font-size: 16px; }
  .picker__head .input { height: 40px; }
  .upload-previews .input { height: 40px; font-size: 16px; }
  .btn { height: 40px; }
  .btn-sm { height: 40px; padding: 0 12px; font-size: 12px; }
  .login-card .password-logout .btn-block { height: 40px; }
  .seg a { height: 40px; }
  .month-nav a { height: 40px; }
  .month-nav__label { line-height: 40px; }
  .check { min-height: 40px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .role-card input { margin-top: 0; }
  .flash__close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin: -10px -12px -10px 0; padding: 0;
  }
  .quick-links a { min-height: 44px; }
  .back-link { min-height: 40px; margin-bottom: 8px; }
  /* Ссылки «Все новости →» и т. п. в заголовках карточек: зона касания 40px без изменения высоты заголовка */
  .link-more { display: inline-flex; align-items: center; min-height: 40px; margin: -12px 0; }
  .filters .filters__actions { height: auto; }
  .bday-quick__form .bday-quick__dm { width: 84px; }
  .bday-quick__form .bday-quick__year { width: 80px; }
}

@media (max-width: 600px) {
  .site-header__inner { gap: 16px; }
  /* Кнопки с длинной подписью переносят текст, а не выходят за экран */
  .btn { height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; white-space: normal; line-height: 1.2; text-align: center; }
  .page-head__actions { width: 100%; }
  .greeting { margin-bottom: 16px; }
  .greeting__summary > span { white-space: normal; }
  .today { min-height: 0; }
  .card-title { flex-wrap: wrap; row-gap: 4px; }
  .figure__value { font-size: 24px; }
  /* На узком экране четыре раздела помещаются в два ряда без разрыва слов. */
  .admin-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .admin-tabs a {
    flex-direction: row; justify-content: flex-start; gap: 8px;
    min-height: 48px; padding: 10px 8px 9px;
    font-size: 11px; letter-spacing: .04em; line-height: 1.2;
    white-space: normal; text-align: left; overflow-wrap: normal;
  }
  .admin-tabs .icon { flex-shrink: 0; }
  .role-stat { padding: 12px; }
  .role-stat__value { font-size: 28px; }
  .section-off { margin-top: 8px; padding: 24px 16px; }
  .section-off__title { font-size: 24px; }
  .section-off__links { grid-template-columns: minmax(0, 1fr); }
  .section-off__actions .btn { flex: 1 1 140px; }
}

@media (max-width: 480px) {
  /* Погода: описание уходит под крупную температуру, чтобы «ощущается как…» не выходило за карточку */
  .weather-main { gap: 12px 18px; }
  .weather-icon .icon { width: 52px; height: 52px; }
  .weather-desc { flex: 1 1 100%; }
  /* «Исполняется N лет» — отдельной строкой под именем */
  .bday-row { flex-wrap: wrap; }
  .bday-row__age { flex-basis: 100%; padding-left: 52px; text-align: left; }
  body.login-page { padding: 16px; }
  .login-card { padding: 28px 20px 24px; }
  .login-brand { margin-bottom: 22px; }
  .login-title { font-size: 24px; }
  .form-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 359px) {
  .brand__tag { display: none; }
}

/* Телефонная книга на телефоне и планшете (до 899px): строка таблицы — карточка. Сверху имя и крупный добавочный,
   ниже мобильные (для ресепшена), городской и e-mail с подписью из data-label; площадка — в строке под именем;
   пустые ячейки не показываются. Только на экране: при печати остаётся таблица */
@media screen and (max-width: 899px) {
  .table.phonebook, .table.phonebook tbody { display: block; }
  .table.phonebook thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .table.phonebook tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .table.phonebook tbody tr:hover { background: none; }
  .table.phonebook td { display: block; min-width: 0; padding: 0; border: 0; }
  .table.phonebook td.cell-main { grid-column: 1; grid-row: 1; }
  .table.phonebook td.cell-ext { grid-column: 2; grid-row: 1; text-align: right; }
  .table.phonebook td.cell-ext::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim);
  }
  .table.phonebook td.cell-phone, .table.phonebook td.cell-mail {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
    margin-top: 6px;
    font-size: 14px;
    white-space: normal;
  }
  .table.phonebook td.cell-phone::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim);
  }
  .table.phonebook td.is-empty, .table.phonebook td.cell-site { display: none; }
  .table.phonebook .cell-sub__site { display: inline; }
  .table.phonebook .cell-person { min-width: 0; }
  .table.phonebook .cell-person a, .table.phonebook .cell-person .service-name { white-space: normal; overflow-wrap: anywhere; }
  .table.phonebook .phone-list { gap: 2px; }
  .table.phonebook .cell-mail a { white-space: normal; overflow-wrap: anywhere; }
  .table.phonebook tr.table-group { display: block; padding: 0; border-bottom: 0; }
  .table.phonebook tr.table-group th { display: block; padding: 22px 0 8px; }
  .table.phonebook tbody:first-of-type tr.table-group th { padding-top: 0; }
}

/* Админка на телефоне и планшете (до 899px): строки пользователей и контактов служб — карточки с подписями полей (data-label) */
@media (max-width: 899px) {
  .users-table, .users-table tbody,
  .contacts-table, .contacts-table tbody { display: block; }
  .users-table thead, .contacts-table thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .users-table tr, .contacts-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 12px 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
  }
  .users-table tbody tr:first-child, .contacts-table tbody tr:first-child { padding-top: 4px; }
  .users-table tbody tr:last-child, .contacts-table tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .users-table tbody tr:hover, .contacts-table tbody tr:hover { background: none; }
  .users-table td, .contacts-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .users-table td[data-label]::before, .contacts-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim);
  }
  .users-table td.cell-main, .users-table td.cell-contacts, .users-table td[data-label="Роль"], .users-table td.cell-actions,
  .contacts-table td.cell-main, .contacts-table td.cell-mail, .contacts-table td.cell-actions { grid-column: 1 / -1; }
  .contacts-table td.cell-main { order: -1; }
  .table .cell-person { min-width: 0; }
  .users-table .cell-person a, .contacts-table .cell-person a { white-space: normal; overflow-wrap: anywhere; }
  .users-table .cell-contacts { min-width: 0; }
  .users-table .status-cell { min-width: 0; }
  .users-table tr.is-nobday { padding-left: 12px; box-shadow: inset 3px 0 0 var(--attention-line); }
  .users-table tr.is-nobday > td:first-child { box-shadow: none; }
  .users-table .role-quick { gap: 6px; }
  .users-table .select-sm { max-width: 100%; }
  .table .cell-actions { text-align: left; white-space: normal; }
  .actions-stack { display: flex; flex-direction: row; flex-wrap: wrap; }
  .actions-stack .btn { width: auto; }
  .contacts-table .actions-row { flex-wrap: wrap; justify-content: flex-start; }
  .contacts-table .btn-edit-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .contacts-table .cell-order { width: auto; }
}

/* Разделы (админка) до 899px: каждая строка — блок; на телефоне кнопка на всю ширину */
@media (max-width: 899px) {
  .sections-table, .sections-table tbody { display: block; }
  .sections-table thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .sections-table tr { display: block; padding: 16px 0; border-bottom: 1px solid var(--line); }
  .sections-table tr:first-child { padding-top: 0; }
  .sections-table tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .sections-table tbody tr:hover { background: none; }
  .sections-table td { display: block; padding: 0; border: 0; }
  .section-cell { min-width: 0; }
  .section-state { margin-top: 12px; white-space: normal; }
  .sections-table td.cell-actions { margin-top: 12px; text-align: left; }
  .sections-table .cell-actions .inline-form { display: block; }
}
@media (max-width: 600px) {
  .sections-table .cell-actions .btn { width: 100%; }
}

/* ==========================================================================
   v7 — светлая и тёмная темы (§37): переключатель в шапке, в мобильном меню
   и в углу страниц без шапки (вход, смена пароля). Только токены.
   ========================================================================== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 40px; height: 40px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--text); background: var(--bg-elev-2); border-color: var(--line-strong); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle__icon { display: inline-flex; }
.theme-toggle__label { display: none; }
/* Иконка — по текущей теме: в светлой луна («включить тёмную»), в тёмной солнце */
.theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--sun { display: inline-flex; }

/* Шапка, десктоп: иконка рядом с профилем. Зона нажатия 40×40, а в строке меню кнопка занимает 24px
   (отрицательные поля) — десять пунктов администратора по-прежнему помещаются в 1100 px */
@media (min-width: 1100px) {
  .site-nav__list { margin-right: auto; }
  .theme-toggle--nav { margin: 0 -8px; }
  .theme-toggle--nav + .site-nav__user { margin-left: 0; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  .site-header__inner { gap: 12px; }
  .site-nav__link { padding: 0 3px; }
  .site-nav__user { gap: 8px; }
}
/* Мобильное меню: отдельная строка с подписью «Тёмная тема» / «Светлая тема» */
@media (max-width: 1099px) {
  .theme-toggle--nav {
    width: auto;
    height: 46px;
    justify-content: flex-start;
    padding: 0 24px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
  }
  .theme-toggle--nav:hover { background: var(--bg-elev-2); }
  .theme-toggle--nav .theme-toggle__label--to-dark { display: inline; }
  :root[data-theme="dark"] .theme-toggle--nav .theme-toggle__label--to-dark { display: none; }
  :root[data-theme="dark"] .theme-toggle--nav .theme-toggle__label--to-light { display: inline; }
}

/* Шапка гостя (страница ошибки без входа): переключатель рядом с «Войти»; на узком телефоне подпись
   «Корпоративный портал» у логотипа уступает им место */
.site-nav--guest { gap: 8px; align-items: center; }
@media (max-width: 440px) {
  .site-header--guest .brand__tag { display: none; }
}

/* Вход и смена пароля: небольшая кнопка в правом верхнем углу страницы */
.theme-toggle--corner {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg-elev);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.theme-toggle--corner:hover { border-color: var(--text-dim); }
/* Кнопка в углу не должна наезжать на карточку, когда та выше экрана */
body.login-page { padding-top: 72px; padding-bottom: 48px; }
@media (max-width: 480px) {
  body.login-page { padding-top: 68px; }
  .theme-toggle--corner { top: 14px; right: 14px; }
}

@media print {
  .theme-toggle { display: none !important; }
}

/* Shared tasks/chat administration: narrow forms and readable comparison tables. */
/* Direct links to account fields must clear the sticky header and their labels. */
main :is(#email,#password){scroll-margin-top:calc(var(--header-h) + 32px)}
.collaboration-admin .ca-filters{display:flex;flex-wrap:wrap;gap:16px;align-items:end;margin:20px 0}
.collaboration-admin .ca-filters label{display:grid;gap:6px;flex:1 1 190px}
.collaboration-admin .ca-columns{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr);gap:24px;margin:20px 0}
.collaboration-admin .ca-form{display:flex;flex-direction:column;gap:16px;align-items:stretch}
.collaboration-admin .ca-form>label{display:grid;gap:6px}
.collaboration-admin .ca-form>label.check{display:flex}
.collaboration-admin .ca-form>.btn{align-self:start}
.collaboration-admin .card{margin-bottom:20px}
.collaboration-admin .ca-role,.collaboration-admin .ca-rule{padding:16px 0;border-bottom:1px solid var(--line)}
.collaboration-admin summary{cursor:pointer;line-height:1.6}
.collaboration-admin .ca-permission{margin:10px 0;align-items:start}
.collaboration-admin .ca-permission small{display:block;font-weight:normal;color:var(--text-dim)}
.collaboration-admin fieldset{border:0;padding:0;margin:0}
.collaboration-admin pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px}
.collaboration-admin td{vertical-align:top;line-height:1.7}
.collaboration-admin .ca-pagination{display:flex;gap:20px;justify-content:center;margin:24px 0}
.collaboration-admin .ca-error{border-left:4px solid var(--danger)}
@media(max-width:900px){.collaboration-admin .ca-columns{grid-template-columns:1fr}}


/* Keep access and department actions beside their labelled values on narrow screens. */
.collaboration-admin :is(.ca-columns > *, .ca-form, .ca-filters label){min-width:0}
.collaboration-admin :is(.ca-role, .ca-rule, .ca-table td){overflow-wrap:anywhere}
@media(max-width:899px){
 .collaboration-admin .ca-table,.collaboration-admin .ca-table tbody{display:block}
 .collaboration-admin .ca-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
 .collaboration-admin .ca-table tbody tr{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:20px 0;border-bottom:1px solid var(--line)}
 .collaboration-admin .ca-table tbody tr:first-child{padding-top:0}
 .collaboration-admin .ca-table tbody tr:last-child{border-bottom:0;padding-bottom:0}
 .collaboration-admin .ca-table td{display:block;padding:0;border:0;min-width:0}
 .collaboration-admin .ca-table td[data-label]::before{content:attr(data-label);display:block;font-size:11px;line-height:1.4;color:var(--text-dim);margin-bottom:4px}
 .collaboration-admin .ca-table td[data-label="Действия"] a{display:inline-flex;align-items:center;min-height:40px}
 .collaboration-admin .ca-pagination{flex-wrap:wrap;gap:12px}
}
@media(min-width:600px) and (max-width:899px){
 .collaboration-admin .ca-table tbody tr{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 24px}
 .collaboration-admin .ca-table td:is(:first-child,[data-label="Действия"],[colspan]){grid-column:1/-1}
}

.collaboration-admin .ca-columns>.card{margin-top:0}
.collaboration-admin .ca-rule form{display:inline-block;margin:8px 8px 0 0}

/* Working collaboration views share the portal header. The frame shares
   ERKON theme tokens and typography; all requests use the authenticated host. */
.collaboration-page .site-footer{display:none}
/* Daily work belongs to the portal. Keep the primary menu visible on laptops. */
.portal-global-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
.portal-global-actions:empty{display:none}
.nav-group details{position:relative}
.nav-group summary{cursor:pointer;list-style:none}
.nav-group summary::-webkit-details-marker{display:none}
.nav-group summary::after{content:'';width:6px;height:6px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg);margin:-4px 2px 0 8px}
.nav-group details[open]>summary{color:var(--accent-text);background:var(--chip-bg)}
.nav-group details[open]>summary::after{transform:rotate(225deg);margin-top:3px}
.nav-group__items{position:absolute;top:100%;left:0;width:240px;max-width:calc(100vw - 32px);max-height:calc(100dvh - var(--header-h) - 16px);overflow-y:auto;margin:0;padding:6px;list-style:none;background:var(--bg-elev);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);z-index:60}
.site-nav .nav-group__items .site-nav__link{display:flex;flex-wrap:wrap;gap:4px 10px;height:auto;min-height:44px;padding:10px 12px;border:0;border-radius:var(--radius);font-size:14px;line-height:1.4;letter-spacing:0;text-transform:none;white-space:normal}
.nav-group__items .site-nav__label{min-width:0;flex:1}
.nav-group__items .site-nav__link:hover,.nav-group__items .site-nav__link:focus-visible{background:var(--bg-elev-2)}
.nav-group__items .site-nav__link.is-active{background:var(--chip-bg);box-shadow:inset 3px 0 var(--accent-text)}
.nav-group__items .site-nav__link.is-restricted .site-nav__lock{position:static;width:13px;height:13px;flex-shrink:0}
.site-header--collaboration .brand__tag{display:none}
.site-header--collaboration .site-nav__name{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.site-header--collaboration .site-nav__list{gap:2px}
.site-header--collaboration .site-nav__link{padding-left:9px;padding-right:9px}
.collaboration-workspace{min-height:calc(100dvh - 150px)}
.corporate-heading{margin:36px 0 20px;font:500 24px var(--font-display);text-transform:uppercase}
.dash-grid--work .dash-today__day{font-size:48px}.dash-grid--work .dash-today{min-height:0}
.portal-person-actions{display:flex;gap:10px;margin-bottom:20px}
@media(min-width:1100px){
 .site-header--collaboration .nav-toggle{display:none}
 .site-header--collaboration .site-nav{display:flex;position:static;width:auto;padding:0;background:none;border:0;box-shadow:none;align-items:center;flex:1}
 .site-header--collaboration .site-nav__list{display:flex;flex-direction:row;align-items:center}
 .site-header--collaboration .site-nav__user{display:flex;margin:0;padding:0;border:0}
 .site-header--collaboration .site-nav__minor-label{display:none}
 .site-header--collaboration .site-nav .theme-toggle{width:auto}
 .portal-global-actions{order:3;margin-left:8px}
}
@media(max-width:1099px){
 .nav-group__items{position:static;width:auto;max-width:none;max-height:none;overflow:visible;box-shadow:none;border:0;border-left:2px solid var(--line);margin:0 16px 8px 24px;padding:2px 0 2px 6px}
 .nav-group__items .site-nav__note{flex-basis:100%;margin:0;padding:0;font-size:11px;line-height:1.4;letter-spacing:0;white-space:normal}
 .portal-global-actions{margin-left:auto}
}

/* Corporate information follows the working queues, in a compact layout. */
.dash-grid--work .dash-meetings,.dash-grid--work .dash-duty,.dash-grid--work .dash-absences{order:1;grid-column:span 4}
.dash-grid--work .dash-news,.dash-grid--work .dash-bdays{order:2;grid-column:span 6}
.dash-grid--work .dash-today,.dash-grid--work .dash-weather{order:3;grid-column:span 6}
.dash-grid--work .dash-phonebook,.dash-grid--work .dash-gallery,.dash-grid--work .dash-links{order:4}
.dash-grid--work .today__date,.dash-grid--work .today__day,.dash-grid--work .today__month{font-size:28px}
.dash-grid--work .today__clock{font-size:28px;margin-top:8px}.dash-grid--work .today__year,.dash-grid--work .today__meta{display:none}
.dash-grid--work .weather-temp{font-size:36px}.dash-grid--work .weather-days,.dash-grid--work .weather-note{display:none}
.dash-grid--work .dash-today,.dash-grid--work .dash-weather{min-height:0;padding:20px}
.portal-nav-count{margin-left:5px;font-size:10px;background:var(--accent);color:var(--accent-ink);padding:2px 5px;border-radius:2px}
.work-primary-compact{display:none}
@media(max-width:1099px){.work-primary-compact{display:flex;gap:0;background:var(--bg-elev);border-bottom:1px solid var(--line);padding:0 24px}.work-primary-compact a{padding:12px;font-size:11px;letter-spacing:.05em;text-transform:uppercase}.work-primary-compact a[aria-current=page]{box-shadow:inset 0 -2px var(--accent);color:var(--accent-text)}.portal-global-actions{order:0}}
@media(max-width:700px){.dash-grid--work>section{grid-column:1/-1!important}.work-primary-compact{padding:0 12px;justify-content:space-between}.site-header--collaboration .brand{margin-right:auto}.site-header--collaboration .nav-toggle{margin-left:8px}.portal-global-actions{margin-left:0}}


/* Admin usability 18.10: all six columns fit; names and contacts may wrap. */
@media (min-width: 1200px) {
  .users-table { table-layout: fixed; }
  .users-table th:nth-child(1) { width: 24%; }
  .users-table th:nth-child(2) { width: 17%; }
  .users-table th:nth-child(3) { width: 18%; }
  .users-table th:nth-child(4) { width: 15%; }
  .users-table th:nth-child(5) { width: 12%; }
  .users-table th:nth-child(6) { width: 14%; }
  .users-table th, .users-table td { padding-left: 10px; padding-right: 10px; }
  .users-table .cell-person, .users-table .cell-person > div, .users-table .cell-contacts, .users-table .status-cell { min-width: 0; }
  .users-table .cell-person a, .users-table td, .users-table .cell-sub { white-space: normal; overflow-wrap: anywhere; }
  .users-table .select-sm { width: 100%; max-width: 100%; }
  .users-table .role-cell, .users-table .role-quick { width: 100%; min-width: 0; }
  .users-table .actions-stack { display: flex; width: 100%; }
  .users-table .actions-stack .btn { min-width: 0; padding-left: 8px; padding-right: 8px; white-space: normal; height: auto; min-height: 32px; }
  .users-table .badge { max-width: 100%; white-space: normal; }
}
@media (min-width: 900px) and (max-width: 1199px) {
  .users-table, .users-table tbody { display: block; }
  .users-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .users-table tr { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
  .users-table td { display: block; min-width: 0; border: 0; padding: 0; overflow-wrap: anywhere; }
  .users-table td[data-label]::before { content: attr(data-label); display: block; color: var(--text-dim); font-size: 11px; margin-bottom: 6px; }
  .users-table .cell-person, .users-table .cell-person > div, .users-table .cell-contacts, .users-table .status-cell { min-width: 0; }
  .users-table .cell-person a { white-space: normal; }
  .users-table .cell-actions { grid-column: 1 / -1; text-align: left; }
  .users-table .actions-stack { display: flex; flex-direction: row; flex-wrap: wrap; }
  .users-table .actions-stack .btn { width: auto; }
  .users-table .select-sm { max-width: 100%; }
}
.users-table .bday-quick__date { width: 100%; max-width: 160px; min-width: 0; }
/* Statuses may wrap at any viewport or browser text size, without a fixed badge height. */
.users-table .status-cell { gap: 6px; }
.users-table .badge { height: auto; min-height: 20px; max-width: 100%; padding: 3px 7px; line-height: 1.35; white-space: normal; overflow-wrap: normal; }
.users-table .badge-email-required { color: var(--warn); border-color: var(--warn); text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; }
.status-cell__action { display: inline-flex; align-items: center; min-height: 32px; max-width: 100%; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.status-cell__action:hover { text-decoration-thickness: 2px; }
.status-cell__note { max-width: 100%; color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.avatar-upload__form { min-width: 0; }
.avatar-upload input[type=file] { width: 100%; min-width: 0; max-width: 100%; }
.avatar-crop[hidden] { display: none; }
.avatar-crop { margin: 16px 0; max-width: 400px; }
.avatar-crop__frame { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 12px 0; overflow: hidden; border: 1px solid var(--line-strong); background: var(--bg-elev-2); }
.avatar-crop canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.avatar-crop canvas:active { cursor: grabbing; }
.avatar-crop__frame:focus-within { outline: 3px solid var(--accent-text); outline-offset: 3px; }
.avatar-crop__mask { pointer-events: none; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--crop-outline); box-shadow: 0 0 0 100px var(--crop-overlay); }
.avatar-crop__zoom { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.avatar-crop__zoom input { flex: 1; min-width: 0; accent-color: var(--accent-text); }
.avatar-crop__zoom .btn { min-width: 44px; min-height: 44px; justify-content: center; }
.avatar-crop__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-crop output { font-variant-numeric: tabular-nums; margin-left: 8px; }
@media (max-width: 600px) { .avatar-upload { flex-direction: column; align-items: stretch; } .avatar-crop { max-width: 100%; } }

@media (max-width: 400px) { .role-stat .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; } }

/* Messenger is a workspace: the portal navigation owns the only outer header. */
body.messenger-page{height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.messenger-page .site-header{flex:0 0 auto}
.messenger-page .site-header__inner{max-width:none}
.messenger-page .collaboration-workspace{flex:1;min-height:0;width:100%;max-width:none;margin:0;padding:0;display:flex;flex-direction:column}
.messenger-page #root.collaboration-app{flex:1;min-height:0;height:100%;display:flex;flex-direction:column}

/* Keep all header actions reachable on 320px screens. */
@media (max-width: 400px) {
  .site-header__inner { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .site-header .logo-img { height: 22px; }
  .site-header .portal-global-actions { gap: 0; margin-left: auto; flex-shrink: 0; }
  .site-header .nav-toggle { flex: 0 0 40px; margin-left: 0; }
  .role-stat .badge { height: auto; min-height: 20px; padding: 3px 6px; line-height: 1.3; font-size: 10px; letter-spacing: .02em; overflow-wrap: normal; }
}
