/* POWERSKY.AI — стиль «Ночной штаб». Тёмная тема по умолчанию, светлая через [data-theme="light"]. */
:root,
:root[data-theme="dark"] {
  --bg: #0A0C0F;
  --rail: #0E1014;
  --panel: #12151A;
  --line: #1E232B;
  --ctl: #2A303A;
  --ctl-bg: #12151A;
  --hover: #161A20;
  --active-bg: #1C2129;
  --active-fg: #F5B544;
  --avatar: #232933;
  --text: #E8EAED;
  --text-2: #C9CED6;
  --muted: #9AA3AF;
  --accent: #F5B544;
  --accent-text: #F5B544;
  --accent-hover: #FFD08A;
  --on-accent: #0A0C0F;
  --ok: #5FD08A;      --ok-dot: #5FD08A;   --ok-bg: rgba(95, 208, 138, 0.12);
  --warn: #F5B544;    --warn-dot: #F5B544; --warn-bg: rgba(245, 181, 68, 0.14);
  --bad: #F07167;     --bad-dot: #F07167;  --bad-bg: rgba(240, 113, 103, 0.14);
  --info: #6EA8FE;
  --photo-bg: linear-gradient(180deg, #1C2129, #161A20);
  --photo-fig: #2A303A;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F4F5F7;
  --rail: #FFFFFF;
  --panel: #FFFFFF;
  --line: #E4E7EC;
  --ctl: #D5DAE1;
  --ctl-bg: #FFFFFF;
  --hover: #F0F2F5;
  --active-bg: #FFF4DD;
  --active-fg: #A15C00;
  --avatar: #E9ECF0;
  --text: #111418;
  --text-2: #3A4250;
  --muted: #5B6472;
  --accent: #F5B544;
  --accent-text: #A15C00;
  --accent-hover: #7A4500;
  --on-accent: #111418;
  --ok: #17803F;      --ok-dot: #2FB36A;   --ok-bg: #E4F5EA;
  --warn: #A15C00;    --warn-dot: #F5B544; --warn-bg: #FFF1D6;
  --bad: #C4342B;     --bad-dot: #E5484D;  --bad-bg: #FDE7E6;
  --info: #2563D9;
  --photo-bg: linear-gradient(180deg, #EEF0F3, #E3E6EB);
  --photo-fig: #C9CED6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
h1, h2 { margin: 0; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Каркас */
.app { min-height: 100vh; display: flex; }

/* Боковое меню: развёрнуто 256px, свёрнуто 76px, на телефоне выезжает поверх */
.sidebar {
  --sb-w: 256px;
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--rail); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px; padding: 16px 12px;
  overflow-y: auto; overflow-x: hidden; z-index: 30;
  transition: width 0.18s ease;
}
.sb-head { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.logo {
  width: 40px; height: 40px; flex: none; border-radius: 10px; border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-text); font-weight: 700; font-size: 15px;
}
.sb-brand { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.sb-brand strong { font-size: 15px; letter-spacing: 0.04em; }
.sb-brand small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sb-toggle {
  width: 36px; height: 36px; flex: none; border: 1px solid var(--ctl); border-radius: 9px;
  background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.sb-toggle:hover { color: var(--text); background: var(--hover); }
.sb-toggle svg { transition: transform 0.18s ease; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
/* развёрнутое меню: прокручиваются только пункты, низ (админка, тема, пользователь) всегда виден */
:root:not([data-sidebar="collapsed"]) .sb-nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sb-foot { flex: none; }
.sb-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
/* Пользователь внизу меню */
.sb-user { display: flex; align-items: center; gap: 4px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.sb-user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; color: var(--text); }
.sb-user-link:hover { background: var(--hover); color: var(--text); }
.sb-avatar { width: 36px; height: 36px; font-size: 12px; }
.sb-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout-form { display: flex; }
.sb-logout { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.sb-logout:hover { background: var(--bad-bg); color: var(--bad); }
/* подпись кнопки темы зависит от текущей темы */
.theme-text::before { content: "Светлая тема"; }
:root[data-theme="light"] .theme-text::before { content: "Тёмная тема"; }
.sb-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; width: 100%;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; white-space: nowrap;
}
.sb-item svg { flex: none; }
a.sb-item:hover, .sb-parent:hover { background: var(--hover); color: var(--text); }
.sb-item.on { background: var(--active-bg); color: var(--active-fg); }
.sb-item.soon { cursor: default; opacity: 0.5; }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
.sb-badge {
  margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--ctl); color: var(--muted);
}
.sb-chev { margin-left: auto; transition: transform 0.18s ease; }
.sb-group.open .sb-chev { transform: rotate(180deg); }

.sb-sub { display: none; flex-direction: column; gap: 1px; padding: 4px 0 6px 44px; }
.sb-group.open .sb-sub { display: flex; }
.sb-sub-title { display: none; }
.sb-subitem {
  display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px; white-space: nowrap;
}
.sb-subitem-2 { padding-left: 24px; font-size: 13px; min-height: 34px; }
.sb-subitem:hover { background: var(--hover); color: var(--text); }
.sb-subitem.on { color: var(--active-fg); background: var(--active-bg); font-weight: 600; }

/* Свёрнутое меню: только иконки, подменю всплывает справа */
:root[data-sidebar="collapsed"] .sidebar { --sb-w: 76px; overflow: visible; }
:root[data-sidebar="collapsed"] .sb-label { display: none; }
:root[data-sidebar="collapsed"] .sb-head { flex-direction: column; }
:root[data-sidebar="collapsed"] .sb-toggle svg { transform: rotate(180deg); }
:root[data-sidebar="collapsed"] .sb-item { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .sb-group { position: relative; }
:root[data-sidebar="collapsed"] .sb-sub,
:root[data-sidebar="collapsed"] .sb-group.open .sb-sub { display: none; }
:root[data-sidebar="collapsed"] .sb-group:hover .sb-sub,
:root[data-sidebar="collapsed"] .sb-group:focus-within .sb-sub {
  display: flex; position: absolute; left: calc(100% + 8px); top: 0; min-width: 220px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
:root[data-sidebar="collapsed"] .sb-group:hover .sb-sub::before { /* мостик, чтобы курсор не «терял» меню */
  content: ""; position: absolute; left: -10px; top: 0; bottom: 0; width: 10px;
}
:root[data-sidebar="collapsed"] .sb-sub-title {
  display: block; padding: 4px 12px 8px; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
:root[data-sidebar="collapsed"] .sb-subitem-2 { padding-left: 12px; }
:root[data-sidebar="collapsed"] .sb-user { flex-direction: column; gap: 6px; }
:root[data-sidebar="collapsed"] .sb-user-link { justify-content: center; padding: 4px; }

.btn.sb-burger { display: none; }
/* Верхняя полоса нужна только на телефоне - там в ней кнопка меню */
.topbar.topbar-mobile { display: none; }
.topbar-brand { font-weight: 700; letter-spacing: .04em; color: var(--text); }
.sb-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }

@media (max-width: 900px) {
  .sidebar, :root[data-sidebar="collapsed"] .sidebar {
    --sb-w: 280px; position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
  }
  .sidebar.open { transform: none; }
  :root[data-sidebar="collapsed"] .sb-label { display: inline; }
  :root[data-sidebar="collapsed"] .sb-head { flex-direction: row; }
  :root[data-sidebar="collapsed"] .sb-item { justify-content: flex-start; padding: 0 12px; }
  :root[data-sidebar="collapsed"] .sb-group.open .sb-sub { display: flex; position: static; box-shadow: none; border: 0; padding: 4px 0 6px 44px; background: none; }
  :root[data-sidebar="collapsed"] .sb-sub-title { display: none; }
  :root[data-sidebar="collapsed"] .sb-group:not(.open) .sb-sub { display: none; }
  .sb-toggle svg, :root[data-sidebar="collapsed"] .sb-toggle svg { transform: none; }
  .btn.sb-burger { display: inline-flex; }
  .topbar.topbar-mobile { display: flex; }
  :root[data-sidebar="collapsed"] .sb-user { flex-direction: row; }
  :root[data-sidebar="collapsed"] .sb-user-link { justify-content: flex-start; padding: 4px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sb-toggle svg, .sb-chev { transition: none; }
}

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--rail);
}
.page { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 16px; width: 100%; min-width: 0; }

/* Элементы управления */
.btn {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--ctl); border-radius: 10px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.btn:hover { background: var(--hover); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
:root[data-theme="light"] .btn-primary:hover { background: #FFC766; border-color: #FFC766; }
.btn-icon { width: 44px; padding: 0; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }
.row-actions > * { display: inline-flex; vertical-align: middle; margin: 0; }
.row-actions > * + * { margin-left: 6px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 13px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ctl); border-radius: 10px; background: var(--ctl-bg); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
.select {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--ctl); border-radius: 10px;
  background: var(--ctl-bg); color: var(--text); font: inherit;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--avatar);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none;
}
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-light { display: block; }
:root[data-theme="light"] .theme-icon-dark { display: none; }

/* Заголовок страницы */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Показатели */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.kpi { background: var(--panel); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi-value { font-family: "IBM Plex Mono", monospace; font-size: 26px; }
.kpi-note { font-size: 13px; color: var(--muted); }

/* Табы и фильтры */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.tab { min-height: 36px; padding: 0 14px; border-radius: 7px; display: inline-flex; align-items: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.tab:hover { color: var(--text); }
/* активная вкладка «жирнее» за счёт тени, а не font-weight - ширина не меняется, соседи не прыгают */
.tab.on { background: var(--avatar); color: var(--text); text-shadow: 0.35px 0 0 currentColor, -0.35px 0 0 currentColor; }

/* Карточки и таблицы */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.scroll-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; padding: 12px; white-space: nowrap;
}
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:hover { background: var(--hover); }
.table-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.person-link { display: flex; align-items: center; gap: 12px; color: var(--text); min-height: 44px; }
.person-link:hover { color: var(--text); }
.thumb { width: 36px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--avatar); }
.thumb-empty {
  width: 36px; height: 48px; border-radius: 6px; flex: none; background: var(--avatar);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--muted);
}
.sub { font-size: 13px; color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-valid { background: var(--ok-bg); color: var(--ok); }
.chip-expiring { background: var(--warn-bg); color: var(--warn); }
.chip-expired { background: var(--bad-bg); color: var(--bad); }

.state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.state-valid, .state-ok { color: var(--ok); }
.state-expiring, .state-warn { color: var(--warn); }
.state-expired, .state-bad { color: var(--bad); }
.state-mute { color: var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }

.pager { display: flex; gap: 6px; }

/* Карточка сотрудника */
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.profile { padding: 24px; display: flex; flex-wrap: wrap; gap: 28px; }
.photo-col { flex: none; width: 200px; display: flex; flex-direction: column; gap: 10px; }
.photo {
  width: 200px; height: 266px; border-radius: 12px; border: 1px solid var(--ctl);
  object-fit: cover; display: block; background: var(--photo-bg);
}
.photo-empty { display: flex; align-items: flex-end; justify-content: center; overflow: hidden; color: var(--photo-fig); }
.photo-hint { font-size: 12px; color: var(--muted); text-align: center; }
.photo-missing { color: var(--bad); font-weight: 600; }
.profile-body { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); }
.fields { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 20px; }
.fields div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fields dt { font-size: 12px; color: var(--muted); }
.fields dd { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.fields dd.mono { font-size: 14px; font-weight: 400; }
.block { display: flex; flex-direction: column; gap: 10px; }
.block + .block { padding-top: 18px; border-top: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-wide { flex: 999 1 540px; min-width: 0; }
.col-side { flex: 1 1 320px; min-width: 0; }
.col-half { flex: 1 1 420px; min-width: 0; }
.now { border-color: var(--ctl); display: flex; flex-direction: column; gap: 14px; }
.now-site { font-size: 18px; font-weight: 700; color: var(--text); }
.pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.pairs div { display: flex; flex-direction: column; gap: 2px; }
.pairs span:first-child { font-size: 12px; color: var(--muted); }
.pairs span:last-child { font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; }
.tl-axis { display: flex; flex-direction: column; align-items: center; width: 12px; flex: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.tl-dot.current { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--warn-bg); }
.tl-line { flex: 1; width: 2px; background: var(--ctl); margin-top: 4px; }
.timeline li:last-child .tl-line { background: transparent; }
.tl-body { display: flex; flex-direction: column; gap: 3px; padding-bottom: 18px; min-width: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 640px) {
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .photo-col { width: 100%; align-items: center; }
}

/* Формы */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.form-section { display: flex; flex-direction: column; gap: 16px; }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--bad); }
.field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--ctl); border-radius: 10px;
  background: var(--ctl-bg); color: var(--text); font: inherit;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[type="file"] { font: inherit; color: var(--muted); }
.photo-field input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.err { color: var(--bad); font-size: 13px; font-weight: 500; }
.help { color: var(--muted); font-size: 12px; }
.photo-field { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.file-btn { align-self: flex-start; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-bottom: 24px; }
.alert { padding: 14px 18px; border-radius: 12px; font-weight: 500; }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.toasts { display: flex; flex-direction: column; gap: 8px; }

/* Вход, пользователь, доп. статусы */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; padding: 32px; }
.user-box { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; max-width: 240px; text-align: right; }
.state-info { color: var(--info); }
.stack { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 640px) { .user-box { display: none; } }

/* Табель */
.steps { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps li { min-height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 16px; border: 1px solid var(--ctl); color: var(--muted); font-size: 13px; }
.steps li.on { border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.steps li.done { color: var(--ok); border-color: var(--ok-bg); }
.ts-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.ts-grid th, .ts-grid td { border-bottom: 1px solid var(--line); }
.ts-name { position: sticky; left: 0; z-index: 1; background: var(--panel); text-align: left; padding: 6px 10px 6px 12px;
  width: 210px; min-width: 210px; max-width: 210px; box-shadow: 1px 0 0 var(--line); }
/* ФИО - до двух строк, ниже одна строка «код · график · должность» с многоточием; полностью - во всплывающей подсказке */
.ts-person { display: flex; flex-direction: column; gap: 2px; color: var(--text); min-width: 0; flex: 1; }
/* порядковый номер слева от ФИО */
.ts-namewrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ts-no { flex: none; width: 22px; text-align: right; color: var(--muted); font-size: 11px; }
th.ts-name .ts-no { display: inline-block; margin-right: 8px; font-weight: 600; }
.ts-fio { font-weight: 600; font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ts-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-meta > span { margin-right: 6px; }
/* табельный номер - маленькая янтарная плашка */
.ts-tab { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 10.5px; line-height: 16px; font-weight: 500;
  color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
th.ts-name { z-index: 2; color: var(--muted); font-weight: 600; }
.ts-day { min-width: 32px; padding: 6px 0; text-align: center; color: var(--muted); font-weight: 600; }
.ts-day small { display: block; font-weight: 400; font-size: 10px; }
.ts-day a { color: inherit; text-decoration: underline dotted; }
.ts-day.we { color: var(--bad); }
.ts-day.today { color: var(--accent-text); background: var(--warn-bg); }
.ts-cell { text-align: center; padding: 4px 0; border-left: 1px solid var(--line); line-height: 1.15; }
.ts-cell b { display: block; font-weight: 600; }
.ts-cell small { display: block; font-size: 10px; opacity: 0.85; }
.ts-cell.odd small { text-decoration: underline; font-weight: 600; }
.ts-cell.k-plan { opacity: 0.35; }
.ts-cell.k-missing { color: var(--warn); background: repeating-linear-gradient(45deg, transparent 0 4px, var(--warn-bg) 4px 8px); font-weight: 700; }
.ts-dismissed { background: var(--hover); color: var(--muted); font-size: 10px; }
.ts-tot { padding: 6px 5px; text-align: center; }
.ts-tot.first { border-left: 1px solid var(--ctl); }
th.ts-tot { color: var(--muted); font-weight: 600; }
.c-work { background: var(--ok-bg); color: var(--ok); }
.c-off { color: var(--muted); }
.c-sick { background: rgba(110, 168, 254, 0.14); color: var(--info); }
.c-vac { background: var(--warn-bg); color: var(--warn); }
.c-unpaid { background: var(--hover); color: var(--text-2); }
.c-absent { background: var(--bad-bg); color: var(--bad); }
.c-idle { background: rgba(183, 148, 246, 0.14); color: #9B7BE0; }
.c-other { background: rgba(183, 148, 246, 0.18); color: #9B7BE0; }
.ts-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 5px; border-radius: 5px; font-weight: 600; background: var(--hover); }
.ts-chip.big { min-height: 40px; padding: 0 12px; font-size: 15px; }
.ts-chip.k-missing { color: var(--warn); }
.info-text { color: var(--info); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.day-form { display: flex; flex-direction: column; gap: 8px; max-width: 860px; }
.day-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.day-row.planned { border-color: var(--warn-bg); box-shadow: inset 3px 0 0 var(--warn-dot); }
.day-row.blocked { border-color: var(--bad); }
.day-person { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.day-inputs { display: flex; align-items: center; gap: 8px; }
.code-select { min-width: 220px; font-weight: 600; }
.hours-input { width: 80px; }
.day-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 640px) {
  .code-select { min-width: 0; flex: 1; }
  .day-inputs { width: 100%; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Пользователи */
.chip-role { border: 1px solid var(--ctl); color: var(--text-2); }
.chip-accent { background: var(--accent); color: var(--on-accent); }
tr.row-off td { opacity: .55; }
tr.row-off td.row-actions { opacity: 1; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.role-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--ctl); border-radius: 10px; color: var(--text); }
.role-card:hover { background: var(--hover); color: var(--text); }
/* Галочки в формах (роли, объекты) */
.field.checks > div { display: flex; flex-direction: column; gap: 2px; }
.field.checks > div label { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 8px 0; font-size: 14px; cursor: pointer; }
.field.checks input[type="checkbox"], .field.check input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.field.check { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.field.check input[type="checkbox"] { order: -1; }
.field.check > label:first-child { font-size: 14px; color: var(--text); cursor: pointer; }
.field.check > .help, .field.check > .err { flex-basis: 100%; }
/* в нижней части меню подменю раскрывается вверх, чтобы не уходить за край экрана */
:root[data-sidebar="collapsed"] .sb-foot .sb-group:hover .sb-sub,
:root[data-sidebar="collapsed"] .sb-foot .sb-group:focus-within .sb-sub { top: auto; bottom: 0; }

/* Карта территории объекта */
.site-map { display: flex; flex-direction: column; gap: 10px; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.site-map .search input { border: 0; min-height: 0; padding: 0; background: transparent; }
.map-canvas { height: 480px; border-radius: 10px; border: 1px solid var(--ctl); overflow: hidden; z-index: 0; }
.map-canvas .leaflet-control-layers, .map-canvas .leaflet-bar a { color: #1b1f24; }
.map-label { background: rgba(14, 17, 22, .78); color: #fff; border: 0; box-shadow: none; font-weight: 600; font-size: 12px; padding: 2px 8px; }
.map-label::before { display: none; }
.map-areas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.map-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.map-area input { flex: 1 1 220px; min-height: 40px; }
.map-area b { flex: 1 1 auto; }
.map-dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.map-total { color: var(--muted); font-size: 13px; padding-top: 4px; }
@media (max-width: 640px) { .map-canvas { height: 360px; } }
.site-map-google .map-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none; border-radius: 4px; }
.map-tools .btn.on { border-color: var(--accent); color: var(--accent-text); }
[hidden] { display: none !important; }
/* Шапка страницы с инструментами справа (Объекты) */
.page-head-tools { align-items: center; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex: 1 1 640px; }
.search-head { flex: 0 1 280px; padding-right: 4px; }
.search-go { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.search-go:hover { background: var(--hover); color: var(--text); }
/* Показатель «Принято / уволено» */
.flow { display: grid; grid-template-columns: auto 1fr 1fr; gap: 2px 14px; align-items: baseline; margin-top: 4px; }
.flow .mono { font-size: 18px; font-weight: 500; }
/* место под полосу прокрутки всегда зарезервировано - страница не сдвигается, когда строк мало */
html { scrollbar-gutter: stable; }
.head-tools .btn-primary { min-width: 150px; } /* одинаковая ширина для «+ Новый объект / офис / база» */
.select-head { max-width: 220px; }
/* Таблица сотрудников: выбор столбцов (шестерёнка) */
.cols-wrap { position: relative; }
#cols-gear[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); }
#cols-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(820px, 94vw); max-height: 72vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 48px rgba(0,0,0,.35); padding: 16px; z-index: 40; text-align: left; }
.cols-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.cols-head b { font-size: 15px; }
.cols-grid { columns: 2 200px; column-gap: 20px; }
.cols-group { border: 0; margin: 0 0 12px; padding: 0; break-inside: avoid; }
.cols-group legend { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 0 4px; }
.cols-item { display: flex; align-items: center; gap: 10px; min-height: 34px; font-size: 14px; cursor: pointer; }
.cols-item input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.cols-item.locked { color: var(--muted); cursor: default; }
.cols-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--ctl); border-radius: 5px; padding: 0 6px; margin-left: auto; white-space: nowrap; }
.cols-foot { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; flex-wrap: wrap; }
.cols-foot .sub { margin-right: auto; align-self: center; }
.table-cols { width: 100%; }
.table-cols td { white-space: nowrap; }
/* заголовки: лёгкая подсветка и перенос по словам */
.table-cols thead th { white-space: normal; vertical-align: bottom; line-height: 1.3; min-width: 72px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border-bottom: 1px solid var(--line); }
.table-cols thead th:first-child { border-top-left-radius: 14px; }
.table-cols thead th:last-child { border-top-right-radius: 14px; }
/* «Сотрудник» и «Должность» - не шире разумного, длинный текст переносится */
.table-cols .c-fio { width: 300px; min-width: 260px; max-width: 320px; white-space: normal; }
.table-cols .c-fio .person-link > span:last-child { min-width: 0; }
.table-cols td.c-fio .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table-cols .c-position { width: 190px; min-width: 150px; max-width: 220px; white-space: normal; }
.table-cols td .mono { font-size: 13px; }
.table-cols td.c-fio { position: sticky; left: 0; background: var(--panel); z-index: 1; box-shadow: 1px 0 0 var(--line); }
.table-cols thead th.c-fio { position: sticky; left: 0; z-index: 2; box-shadow: 1px 0 0 var(--line); }
.table-cols tbody tr:hover td.c-fio { background: color-mix(in srgb, var(--hover) 100%, var(--panel)); }
/* Порядок столбцов: список с перетаскиванием */
.cols-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(220px, 1fr); gap: 20px; }
.cols-sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.cols-order { border-left: 1px solid var(--line); padding-left: 20px; min-width: 0; }
.sort-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sort-item { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 6px 0 8px; border: 1px solid var(--ctl);
  border-radius: 9px; background: var(--ctl-bg); font-size: 14px; cursor: grab; user-select: none; touch-action: none; }
.sort-item:hover { border-color: var(--text-2); }
.sort-item.pinned { cursor: default; background: transparent; border-style: dashed; color: var(--text-2); }
.sort-grip { display: inline-flex; color: var(--muted); flex: none; }
.sort-item:hover .sort-grip { color: var(--accent-text); }
.sort-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sort-btns { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.sort-item:hover .sort-btns, .sort-item:focus-within .sort-btns { opacity: 1; }
@media (hover: none) { .sort-btns { opacity: 1; } }
.sort-btn { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.sort-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.sort-btn:disabled { opacity: .3; cursor: default; }
.sort-hide:hover:not(:disabled) { color: var(--bad); }
.sort-item.dragging { position: fixed; z-index: 100; cursor: grabbing; border-color: var(--accent); background: var(--panel);
  box-shadow: 0 14px 32px rgba(0,0,0,.35); transform: scale(1.03); pointer-events: none; }
.sort-ph { border: 2px dashed var(--accent); border-radius: 9px; background: color-mix(in srgb, var(--accent) 10%, transparent); list-style: none; }
.sort-item.just-moved { animation: just-moved .6s ease; }
@keyframes just-moved { 0% { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 720px) { .cols-body { grid-template-columns: 1fr; } .cols-order { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; } }
/* Перетаскивание заголовков таблицы */
.table-cols thead th:not(.c-fio) { cursor: grab; user-select: none; touch-action: none; }
.table-cols thead th:not(.c-fio):hover { color: var(--text); }
.table-cols thead th.th-dragging { opacity: .35; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }
.th-ghost { position: fixed; z-index: 120; pointer-events: none; transform: translate(12px, -50%); padding: 7px 12px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--accent); color: var(--text); box-shadow: 0 12px 28px rgba(0,0,0,.35);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.th-marker { position: fixed; z-index: 110; width: 3px; border-radius: 2px; background: var(--accent); pointer-events: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.th-marker.noop { opacity: .25; }
.col-flash { animation: col-flash .7s ease; }
@keyframes col-flash { 0% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .sort-item.just-moved, .col-flash { animation: none; } }

/* Настройки → Подключённые сервисы */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.svc { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.svc-head h2 { margin: 0; font-size: 16px; }
.svc-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--ctl); color: var(--text-2); white-space: nowrap; }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.svc-ok .svc-state { background: var(--ok-bg); color: var(--ok); } .svc-ok .svc-dot { background: var(--ok-dot); }
.svc-warn .svc-state { background: var(--warn-bg); color: var(--warn); } .svc-warn .svc-dot { background: var(--warn); }
.svc-manual .svc-dot { background: var(--accent); }
.svc-about { margin: 0; color: var(--text-2); font-size: 14px; }
.svc-rows { margin: 0; width: 100%; display: grid; gap: 6px; }
.svc-rows div { display: grid; grid-template-columns: 170px 1fr; gap: 10px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 6px; }
.svc-rows dt { color: var(--muted); } .svc-rows dd { margin: 0; overflow-wrap: anywhere; }
.svc-env { margin: 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 480px) { .svc-grid { grid-template-columns: 1fr; } .svc-rows div { grid-template-columns: 1fr; gap: 2px; } }
.svc-section { font-size: 15px; margin: 24px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.svc-off .svc-state { background: var(--ctl); color: var(--muted); }
.svc-actions { display: flex; gap: 6px; margin-top: auto; align-self: flex-end; }
.svc-actions form { margin: 0; }
.svc-empty { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-style: dashed; color: inherit; text-decoration: none; max-width: 720px; }
.svc-empty:hover { border-color: var(--accent); }
.svc-plus { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 24px; background: var(--accent); color: var(--on-accent); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }

/* Настройки → Графики работ */
.sch-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.sch-list { flex: 1 1 240px; max-width: 320px; display: flex; flex-direction: column; gap: 8px; }
.sch-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.sch-card:hover { border-color: var(--ctl); }
.sch-card.on { background: var(--active-bg); border: 1.5px solid var(--accent); }
.sch-card-name { font-weight: 600; font-size: 15px; }
.sch-card-sub { font-size: 13px; color: var(--muted); }
.sch-card-who { font-size: 12px; color: var(--muted); opacity: .85; }
.sch-form { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.sch-sec { display: flex; flex-direction: column; gap: 14px; }
.sch-sec h2 { margin: 0; font-size: 16px; }
.sch-grid { display: grid; gap: 12px; }
.sch-grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sch-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sch-grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.sch-grid-boxes { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sch-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 10px; background: var(--ctl-bg); border: 1px solid var(--line); min-width: 0; }
.sch-box .field label { font-size: 12px; }
.sch-label { font-size: 13px; color: var(--muted); }
.sch-days { display: flex; flex-direction: column; gap: 6px; }
.sch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sch-chip { position: relative; cursor: pointer; }
.sch-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sch-chip span { display: inline-grid; place-items: center; width: 48px; height: 38px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--ctl-bg); color: var(--muted); border: 1px solid var(--ctl); }
.sch-chip input:checked + span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.sch-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sch-note { margin: 0; font-size: 13px; color: var(--muted); }
.sch-note b { color: var(--text-2); }
.sch-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.sch-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.sch-timeline-wrap { display: flex; flex-direction: column; gap: 8px; }
.sch-timeline { position: relative; height: 58px; border-radius: 10px; background: var(--ctl-bg); border: 1px solid var(--line); overflow: hidden; }
.sch-tl-work { position: absolute; top: 24px; height: 6px; border-radius: 3px; background: var(--ok-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 35%, transparent); }
.sch-tl-lunch { position: absolute; top: 18px; height: 18px; border-radius: 4px; background: var(--active-bg); }
.sch-tick { position: absolute; top: 20px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--ctl-bg); }
.sch-tick.a { background: var(--accent); }
.sch-tick.d { background: var(--info); }
.sch-tl-l, .sch-tl-r { position: absolute; bottom: 3px; font-size: 10px; color: var(--muted); transform: translateX(-50%); }
.sch-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.sch-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.sch-dot.a { background: var(--accent); } .sch-dot.d { background: var(--info); }
.sch-pick-search { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--ctl); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; }
.sch-pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.sch-pick-item { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 13px; color: var(--text-2); border-radius: 6px; cursor: pointer; }
.sch-pick-item:hover { background: var(--hover); }
.sch-pick-item input { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.sch-pick.has-error { border-color: var(--bad); }
@media (max-width: 480px) { .sch-list { max-width: none; } .sch-grid-3 { grid-template-columns: 1fr; } }

/* ---------- Журнал явки и день сотрудника ---------- */
.att-month { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.att-kind { font-weight: 600; }
.att-late, .att-left_early, .att-outside { color: var(--warn); }
.att-not_came, .att-mock { color: var(--bad); }
.att-no_signal { color: var(--muted); }
.att-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; }
.att-map-card { display: flex; flex-direction: column; overflow: hidden; }
.att-map { flex: 1; min-height: 360px; background: var(--bg); }
.att-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); }
.att-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot-in { background: var(--ok-dot); } .dot-out { background: var(--bad-dot); }
.dot-zone { background: transparent; border: 2px dashed var(--accent); }
.att-sum { display: flex; flex-direction: column; gap: 14px; }
.att-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.att-inc { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.att-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.att-ts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .att-grid { grid-template-columns: 1fr; } }
.att-grid-today { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.att-cal-card { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.att-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.att-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.att-cal-wd { font-size: 12px; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.att-cal-day { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 58px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; overflow: hidden; }
.att-cal-day b { font-size: 13px; }
.att-cal-day small { font-size: 11px; line-height: 1.2; color: inherit; overflow: hidden; text-overflow: ellipsis; }
a.att-cal-day:hover { border-color: var(--accent); color: var(--text); }
.att-cal-day.is-today { border-color: var(--accent); }
.att-c-ok { background: var(--ok-bg); } .att-c-ok small { color: var(--ok); }
.att-c-warn { background: var(--warn-bg); } .att-c-warn small { color: var(--warn); }
.att-c-bad { background: var(--bad-bg); } .att-c-bad small { color: var(--bad); }
.att-c-mute small { color: var(--muted); }
.att-c-future { opacity: .35; }
.att-cal-flag { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 700px) { .att-cal-day small { display: none; } .att-cal-day { min-height: 40px; } }

/* ---------- Выбор сотрудников и быстрые действия ---------- */
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.table .sel-cell { width: 44px; padding-right: 0; }
.sel-cell input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.table tr.row-sel { background: var(--warn-bg); }
.sel-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.sel-bar[hidden] { display: none; }
.sel-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sel-info .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.sel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Выгрузка в Excel ---------- */
.exp-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--panel); color: var(--text); }
.exp-dialog::backdrop { background: rgba(0,0,0,.55); }
.exp-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.exp-head, .exp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.exp-head { border-bottom: 1px solid var(--line); } .exp-head h2 { margin: 0; font-size: 18px; }
.exp-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.exp-body { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px; overflow: auto; }
.exp-scope { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.exp-scope legend { font-weight: 700; margin-bottom: 6px; }
.exp-scope label, .exp-col { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.exp-scope input, .exp-col input { width: 17px; height: 17px; accent-color: var(--accent); }
.exp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.exp-tools-btns { margin-left: auto; display: flex; gap: 6px; }
.exp-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 20px; }
.exp-group { display: flex; flex-direction: column; gap: 6px; }
.exp-col { font-size: 14px; }
/* карта явки: фиксированной высоты и остаётся на виду при прокрутке длинного списка проверок */
.att-grid { align-items: start; }
.att-map-card { position: sticky; top: 16px; }
.att-map { flex: none; height: min(560px, calc(100vh - 140px)); min-height: 360px; }

/* ---------- Оргструктура ---------- */
.org-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
@media (max-width: 1180px) { .org-layout { grid-template-columns: 1fr; } }
.org-stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.org-hint { font-size: 12.5px; color: var(--muted); }
.org-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.org-zoom button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.org-movebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; background: color-mix(in srgb, var(--info) 14%, transparent); border-bottom: 1px solid var(--info); font-size: 13px; }
.org-movebar b { color: var(--info); }
.org-stage { position: relative; overflow: auto; max-height: calc(100vh - 230px); }
.org-sizer { position: relative; overflow: hidden; }
.org-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.org-band { position: absolute; left: 6px; right: 6px; background: var(--hover); border-radius: 10px; }
.org-band span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font: 600 11px "IBM Plex Mono", monospace; letter-spacing: .12em; color: var(--muted); }
.org-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.org-links path { fill: none; stroke: var(--muted); stroke-width: 1.6; opacity: .8; }
.org-links circle { fill: var(--muted); }
.org-node { position: absolute; width: 150px; height: 66px; padding: 6px 8px; border-radius: 7px; background: var(--panel); border: 1.6px solid var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; user-select: none; color: var(--text); }
.org-node .nm { font-weight: 600; font-size: 12.5px; line-height: 1.2; }
.org-node .st { font-size: 10.5px; color: var(--muted); line-height: 1.15; margin-top: 2px; }
.org-node.hl { background: color-mix(in srgb, var(--info) 16%, var(--panel)); border-color: var(--info); }
.org-node.ceo { background: #2C4F86; border-color: #2C4F86; color: #fff; } .org-node.ceo .st { color: #DDE6F3; }
.org-node:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.org-node.sel { box-shadow: 0 0 0 3px var(--accent); }
.org-node.target { box-shadow: 0 0 0 3px var(--info); cursor: copy; }
.org-node.off { opacity: .28; cursor: not-allowed; }
.org-node.moving { box-shadow: 0 0 0 3px var(--accent); }
.org-node.d-added { border-color: var(--ok); background: var(--ok-bg); }
.org-node.d-renamed { border-color: var(--accent); }
.org-node.d-moved { border-color: var(--info); background: color-mix(in srgb, var(--info) 14%, var(--panel)); }
.org-node .badge { position: absolute; top: -9px; right: 6px; font: 600 10px "IBM Plex Sans", sans-serif; padding: 1px 6px; border-radius: 999px; color: var(--bg); }
.org-node .cnt { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font: 600 10px "IBM Plex Mono", monospace; padding: 1px 7px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.org-node .cnt.vac { color: var(--warn); border-color: var(--warn); } .org-node .cnt.over { color: var(--bad); border-color: var(--bad); }
.org-node input.rn { width: 100%; font: 600 12.5px "IBM Plex Sans", sans-serif; text-align: center; border: 1px solid var(--accent); border-radius: 6px; padding: 4px; background: var(--panel); color: var(--text); }
.org-tree { padding: 6px; max-height: calc(100vh - 230px); overflow: auto; }
.org-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.org-row:hover { background: var(--hover); } .org-row.sel { background: var(--warn-bg); border-color: var(--accent); }
.org-row.target { border-color: var(--info); } .org-row.off { opacity: .35; cursor: not-allowed; }
.org-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-row .chip { font: 500 10.5px "IBM Plex Mono", monospace; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.org-side { display: flex; flex-direction: column; gap: 12px; }
.org-pane { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.org-pane h2 { margin: 0; font-size: 15px; }
.org-field { display: flex; flex-direction: column; gap: 4px; }
.org-field > label { font-size: 12px; color: var(--muted); }
.org-field input, .org-field select { width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 14px "IBM Plex Sans", sans-serif; }
.org-two, .org-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.org-check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.org-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.org-seg button { border: 0; min-height: 32px; padding: 0 12px; background: var(--panel); color: var(--muted); font: 600 13px "IBM Plex Sans", sans-serif; cursor: pointer; }
.org-seg button.on { background: var(--warn-bg); color: var(--accent-text); }
.org-confirm { border: 1px solid var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.org-hc { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.org-hc b { text-align: right; font-variant-numeric: tabular-nums; }
.org-eds { display: flex; flex-direction: column; gap: 6px; }
.org-ed { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.org-ed.on { border-color: var(--accent); }
.org-log { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.org-log div { display: grid; grid-template-columns: 42px 1fr; gap: 8px; }
.org-log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.org-box { border: 1px solid var(--accent); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--warn-bg); }
.org-saved { font-size: 12px; color: var(--muted); }
.org-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-weight: 600; z-index: 60; }
.org-toast.err { border-color: var(--bad); color: var(--bad); }

/* ---------- Штатное расписание ---------- */
.stf-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .stf-layout { grid-template-columns: 1fr; } }
.stf-nav { position: sticky; top: 12px; overflow: hidden; }
.stf-nav-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stf-tree { padding: 6px; max-height: calc(100vh - 150px); overflow: auto; }
.stf-unit { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px; border-radius: 7px; cursor: pointer; }
.stf-unit:hover { background: var(--hover); } .stf-unit.sel { background: var(--warn-bg); }
.stf-unit.sel .nm { color: var(--accent-text); font-weight: 600; }
.stf-unit .nm { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.stf-unit .n { font: 500 11.5px "IBM Plex Mono", monospace; color: var(--muted); font-variant-numeric: tabular-nums; }
.stf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.stf-head h2 { margin: 0; font-size: 19px; flex: 1 1 260px; }
.stf-head .crumbs { flex-basis: 100%; order: -1; font-size: 12px; color: var(--muted); }
.stf-fig { font-size: 14px; color: var(--muted); white-space: nowrap; }
.stf-fig b { color: var(--text); font: 600 16px "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.stf-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.stf-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--line); }
.stf-table th.r, .stf-table td.r { text-align: right; }
.stf-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.stf-table tr.changed td { background: color-mix(in srgb, var(--info) 12%, transparent); }
.stf-table tr.added td { background: var(--ok-bg); }
.stf-table td input { width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 14px "IBM Plex Sans", sans-serif; }
.stf-table td input.num { text-align: right; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.stf-table .ro { display: block; padding: 7px 0; } .stf-table .ro.num { text-align: right; font-family: "IBM Plex Mono", monospace; }
.stf-money { display: flex; align-items: center; gap: 6px; } .stf-money span { color: var(--muted); font-size: 12.5px; }
.stf-emp { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 14px "IBM Plex Sans", sans-serif; cursor: pointer; text-align: left; }
.stf-emp:hover { border-color: var(--accent); } .stf-emp .vac { color: var(--muted); font-style: italic; }
.stf-cell-emp { position: relative; }
.stf-emp-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .stf-emp-who .sub { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.stf-picker { position: fixed; z-index: 60; width: 380px; max-width: calc(100vw - 16px); border: 1px solid var(--accent); border-radius: 10px; background: var(--panel); box-shadow: 0 12px 30px rgba(0,0,0,.35); overflow: hidden; min-width: 340px; }
.stf-picker input { width: 100%; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; padding: 9px 12px !important; }
.stf-list { max-height: 280px; overflow: auto; }
.stf-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 12px; cursor: pointer; }
.stf-pick:hover, .stf-pick:focus { background: var(--warn-bg); }
.stf-pick .sub { font-size: 12px; color: var(--muted); }
.stf-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.stf-tag.free { border-color: var(--ok); color: var(--ok); }
.stf-pfoot { padding: 7px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.stf-pfoot button, .stf-add { border: 0; background: none; color: var(--accent-text); cursor: pointer; font: 600 13px "IBM Plex Sans", sans-serif; padding: 4px 0; }
.stf-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }
.stf-approve { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.stf-approve label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.stf-approve input { padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 13.5px "IBM Plex Sans", sans-serif; }
.stf-x { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; cursor: pointer; border-radius: 6px; }
.stf-x:hover { color: var(--bad); background: var(--hover); }
