/* © 2026 ООО «Спецэкоэра». Все права защищены. */
/* =====================================================================
   Компоненты. Названия классов — БЭМ-подобные, без префикса.
   Каждый компонент описан в components.html с примером.
   ===================================================================== */

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: var(--fw-semibold); font-size: var(--fs-md); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
  box-shadow: var(--shadow-xs); user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); }
.btn--accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: var(--text-inverse); }
.btn--danger:hover { filter: brightness(1.06); background: var(--danger); }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn--soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-text); box-shadow: none; }
.btn--soft:hover { background: var(--primary-soft); filter: brightness(.97); border-color: transparent; }
.btn--sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); gap: 6px; }
.btn--lg { height: var(--control-h-lg); padding: 0 20px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn--icon { width: var(--control-h); padding: 0; position: relative; }
.btn--icon.btn--sm { width: 30px; }
.btn .spinner { width: 16px; height: 16px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.spinner { border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Переключатель вида (сегменты) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--surface-3); }
.seg button { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--text); display: flex; gap: 6px; align-items: baseline; }
.field__req { color: var(--danger-text); }
.field__opt { color: var(--text-3); font-weight: 400; }
.field__hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.field__error { display: none; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--danger-text); font-weight: 500; align-items: flex-start; gap: 4px; }
.field__error .ico { width: 14px; height: 14px; margin-top: 1px; }
.field.is-invalid .field__error { display: flex; }
.field.is-invalid .input, .field.is-invalid .select { border-color: var(--danger); }
.field.is-valid .input { border-color: var(--success); }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: var(--lh-md); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: 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='%235f6e82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.input--lg { height: var(--control-h-lg); font-size: var(--fs-lg); }

.check, .radio { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 20px; }
.check input, .radio input {
  appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 1px 0 0; border: 1.5px solid var(--border-strong);
  border-radius: 5px; background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: all var(--dur-1);
}
.radio input { border-radius: 50%; }
.check input:checked { background: var(--primary); border-color: var(--primary); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); background-size: 13px; background-position: center; background-repeat: no-repeat; }
.radio input:checked { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--surface); background: var(--primary); }
.check input:focus-visible, .radio input:focus-visible { box-shadow: var(--focus-ring); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; width: 38px; height: 22px; flex: none; margin: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background var(--dur-2); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { box-shadow: var(--focus-ring); }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-height: 54px; flex-wrap: wrap; }
.card__head h2 { font-size: 15px; flex: 1; min-width: 0; }
.card__head .muted { font-size: 13px; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 16px; border-top: 1px solid var(--border); }
.card--hover { transition: box-shadow var(--dur-2), border-color var(--dur-2), transform var(--dur-2); }
.card--hover:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* KPI */
.kpi { padding: 16px; display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi__label { display: flex; align-items: center; gap: 8px; line-height: 17px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi__icon { width: 30px; height: 30px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-soft-text); flex: none; }
.kpi__icon--danger { background: var(--danger-soft); color: var(--danger-text); }
.kpi__icon--warning { background: var(--warning-soft); color: var(--warning-text); }
.kpi__icon--success { background: var(--success-soft); color: var(--success-text); }
.kpi__icon--accent { background: var(--accent-soft); color: var(--accent-text); }
.kpi__value { white-space: nowrap; font-size: var(--fs-3xl); line-height: var(--lh-3xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.kpi__foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); min-height: 18px; }
.kpi__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; min-width: 0; }
.kpi__spark { flex: 0 1 64px; min-width: 32px; height: 28px; margin-bottom: 4px; overflow: hidden; }
.setup__more { margin-top: 8px; }
a.kpi { color: inherit; text-decoration: none; }
a.kpi:hover { text-decoration: none; }

/* Тренды */
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; border-radius: var(--r-full); padding: 1px 7px 1px 4px; white-space: nowrap; }
.trend .ico { width: 14px; height: 14px; }
.trend--up-good, .trend--down-good { color: var(--success-text); background: var(--success-soft); }
.trend--up-bad, .trend--down-bad { color: var(--danger-text); background: var(--danger-soft); }
.trend--flat { color: var(--neutral-text); background: var(--neutral-soft); }
.trend--down-good .ico, .trend--down-bad .ico { transform: rotate(90deg); }

/* ---------- Бейджи статусов (всегда слово + цвет + точка/иконка) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-text); line-height: 1; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before { display: none; }
.badge--new { background: var(--info-soft); color: var(--info-text); }
.badge--progress { background: var(--primary-soft); color: var(--primary-soft-text); }
.badge--wait { background: var(--warning-soft); color: var(--warning-text); }
.badge--done, .badge--ok { background: var(--success-soft); color: var(--success-text); }
.badge--danger, .badge--down { background: var(--danger-soft); color: var(--danger-text); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge--closed { background: var(--neutral-soft); color: var(--neutral-text); }
.badge--lg { height: 28px; font-size: 13px; padding: 0 11px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }

/* Приоритет */
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.prio i { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.prio i b { width: 3px; border-radius: 1px; background: var(--border-strong); }
.prio i b:nth-child(1) { height: 5px; } .prio i b:nth-child(2) { height: 8px; } .prio i b:nth-child(3) { height: 12px; }
.prio--crit { color: var(--danger-text); } .prio--crit i b { background: var(--danger); }
.prio--high { color: var(--warning-text); } .prio--high i b:nth-child(-n+2) { background: var(--warning); }
.prio--normal i b:nth-child(1) { background: var(--primary); }

/* SLA-светофор: цвет + иконка + слово + остаток времени */
.sla { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sla__lights { display: inline-flex; gap: 3px; padding: 3px 4px; border-radius: var(--r-full); background: var(--surface-3); }
.sla__lights b { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); opacity: .55; }
.sla--ok { color: var(--success-text); } .sla--ok .sla__lights b:nth-child(3) { background: var(--success); opacity: 1; }
.sla--warn { color: var(--warning-text); } .sla--warn .sla__lights b:nth-child(2) { background: var(--warning); opacity: 1; }
.sla--late { color: var(--danger-text); } .sla--late .sla__lights b:nth-child(1) { background: var(--danger); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.sla small { font-weight: 500; color: var(--text-3); }

/* Индикатор состояния аппарата */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-3); }
.dot--ok { background: var(--success); } .dot--warn { background: var(--warning); } .dot--down { background: var(--danger); } .dot--off { background: var(--border-strong); }
.dot--pulse { animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Таблица ---------- */
.table-wrap { overflow: auto; max-width: 100%; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.table-wrap--tall { max-height: 560px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--text); }
.table th .sort { display: inline-flex; vertical-align: -3px; margin-left: 4px; opacity: .35; }
.table th[aria-sort="ascending"] .sort, .table th[aria-sort="descending"] .sort { opacity: 1; color: var(--primary); }
.table th[aria-sort="ascending"] .sort .ico { transform: rotate(-90deg); }
.table th[aria-sort="descending"] .sort .ico { transform: rotate(90deg); }
.table th .sort .ico { width: 14px; height: 14px; transform: rotate(90deg); }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); }
.table .t-right { text-align: right; }
.table--compact td { padding: 8px 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1 1 240px; max-width: 360px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-text); font-weight: 600; }
.chip b { font-weight: 600; font-size: 12px; color: inherit; opacity: .8; }
/* Таблица → карточки на телефоне */
@media (max-width: 767px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table--stack td { border: 0; padding: 3px 0; }
  .table--stack td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 12px; }
  .table--stack td.cell-first::before { content: none; }
}

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.tab .count { font-size: 11px; padding: 1px 6px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); }
.tabpanel { padding-top: 16px; }

/* ---------- Модальные окна, боковая панель ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity var(--dur-2); }
.overlay.is-open { opacity: 1; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform var(--dur-3) var(--ease); border: 1px solid var(--border); }
.overlay.is-open .modal { transform: none; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 4px; }
.modal__head h2 { font-size: 18px; flex: 1; }
.modal__lead { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.modal__body { padding: 16px 20px; display: grid; gap: 16px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; flex-wrap: wrap; }
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-drawer); opacity: 0; transition: opacity var(--dur-2); }
.drawer-overlay.is-open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-drawer) + 1); width: min(440px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--border); display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--dur-3) var(--ease); }
.drawer.is-open { transform: none; }
.drawer--wide { width: min(560px, 100vw); }
.drawer__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { flex: 1; font-size: 17px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }

/* Помощь по экрану: шаги */
.help-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: s; }
.help-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; counter-increment: s; }
.help-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 700; font-size: 13px; }
.help-steps b { display: block; margin-bottom: 2px; }
.help-steps p { color: var(--text-2); font-size: 13px; }
.gloss { display: grid; gap: 8px; margin: 0; }
.gloss div { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.gloss dt { font-weight: 700; font-size: 13px; }
.gloss dd { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

/* Термин с расшифровкой (ТО, SLA, DICOM…) — подсказка по наведению и по фокусу */
.term { border-bottom: 1px dotted currentColor; cursor: help; text-decoration: none; }
.term:focus-visible { border-radius: 2px; }
.tip { position: fixed; z-index: var(--z-tip); max-width: 280px; padding: 8px 10px; border-radius: var(--r-md); background: #0f1b2a; color: #f1f5fa; font-size: 12px; line-height: 17px; box-shadow: var(--shadow-md); pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity var(--dur-1), transform var(--dur-1); }
.tip.is-show { opacity: 1; transform: none; }
.tip b { color: #fff; }
:root[data-theme="dark"] .tip { background: #e8eef5; color: #0f1b2a; }
:root[data-theme="dark"] .tip b { color: #0f1b2a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tip { background: #e8eef5; color: #0f1b2a; } :root:not([data-theme="light"]) .tip b { color: #0f1b2a; } }

/* ---------- Тосты ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in var(--dur-3) var(--ease); }
.toast__icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.toast--success .toast__icon { background: var(--success-soft); color: var(--success-text); }
.toast--warning .toast__icon { background: var(--warning-soft); color: var(--warning-text); }
.toast--danger .toast__icon { background: var(--danger-soft); color: var(--danger-text); }
.toast--info .toast__icon { background: var(--info-soft); color: var(--info-text); }
.toast__text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.toast__text b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all var(--dur-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Пустое состояние ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px; }
.empty__art { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); color: var(--primary-soft-text); margin-bottom: 4px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--text-2); max-width: 420px; }
.empty .row { justify-content: center; margin-top: 6px; }

/* ---------- Скелетон ---------- */
.skel { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; height: 12px; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Аватары ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; color: #fff; background: var(--blue-600); letter-spacing: .02em; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }
.avatar--c1 { background: #1a5bb8; } .avatar--c2 { background: #0a6b60; } .avatar--c3 { background: #7a3db8; } .avatar--c4 { background: #a8441a; } .avatar--c5 { background: #44546a; }
.avatars { display: inline-flex; } .avatars .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; } .avatars .avatar:first-child { margin-left: 0; }
.status-av { position: relative; }
.status-av::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--success); }
.status-av.is-busy::after { background: var(--warning); } .status-av.is-off::after { background: var(--border-strong); }

/* ---------- Командная палитра ---------- */
.palette-overlay { position: fixed; inset: 0; z-index: var(--z-palette); background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; animation: toast-in var(--dur-2) var(--ease); }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette__input input { flex: 1; height: 54px; border: 0; background: none; font-size: 16px; outline: none; min-width: 0; }
.palette__list { max-height: 50vh; overflow: auto; padding: 8px; }
.palette__group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.palette__item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-md); cursor: pointer; color: var(--text); }
.palette__item small { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.palette__item[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-soft-text); }
.palette__item .ico { color: var(--text-3); }
.palette__item[aria-selected="true"] .ico { color: inherit; }
.palette__foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }

/* ---------- Меню-поповер ---------- */
.menu { position: fixed; z-index: var(--z-palette); min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: toast-in var(--dur-2) var(--ease); }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-md); text-align: left; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-3); text-decoration: none; }
.menu__item .ico { color: var(--text-3); }
.menu__item[aria-checked="true"] { color: var(--primary); font-weight: 600; }
.menu__item[aria-checked="true"] .ico { color: var(--primary); }
.menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu__label { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Таймлайн ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 18px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.timeline__icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); border: 2px solid var(--surface); position: relative; z-index: 1; }
.timeline__icon .ico { width: 16px; height: 16px; }
.timeline__icon--primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.timeline__icon--success { background: var(--success-soft); color: var(--success-text); }
.timeline__icon--danger { background: var(--danger-soft); color: var(--danger-text); }
.timeline__icon--warning { background: var(--warning-soft); color: var(--warning-text); }
.timeline__icon--accent { background: var(--accent-soft); color: var(--accent-text); }
.timeline__title { font-weight: 600; padding-top: 5px; }
.timeline__meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.timeline__text { margin-top: 6px; color: var(--text-2); font-size: 13px; }

/* ---------- Чек-лист ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); transition: background var(--dur-1), border-color var(--dur-1); }
.checklist li.is-done { background: var(--success-soft); border-color: transparent; }
.checklist li.is-done .checklist__title { color: var(--text-2); }
.checklist li.is-fail { background: var(--danger-soft); border-color: transparent; }
.checklist__title { font-weight: 600; }
.checklist__norm { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.checklist__body { flex: 1; min-width: 0; }
.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width var(--dur-3) var(--ease); }
.progress--success > span { background: var(--success); }
.progress--warning > span { background: var(--warning); }
.progress--danger > span { background: var(--danger); }

/* Пошаговый индикатор */
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.steps li { flex: 1; display: grid; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; min-width: 0; }
.steps li::before { content: ""; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps li.is-done::before { background: var(--success); }
.steps li.is-current::before { background: var(--primary); }
.steps li.is-current { color: var(--primary); }
.steps li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- «Требует вашего внимания» ---------- */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.attn li:last-child { border-bottom: 0; }
.attn__rank { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.attn__rank--1 { background: var(--danger-soft); color: var(--danger-text); }
.attn__rank--2 { background: var(--warning-soft); color: var(--warning-text); }
.attn__rank--3 { background: var(--info-soft); color: var(--info-text); }
.attn__title { font-weight: 600; }
.attn__why { font-size: 13px; color: var(--text-2); margin-top: 1px; }
@media (max-width: 767px) { .attn li { grid-template-columns: auto 1fr; } .attn li .btn { grid-column: 2; justify-self: start; } }

/* ---------- «Начало работы» ---------- */
.setup { display: grid; gap: 0; list-style: none; margin: 0; padding: 0; }
.setup li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.setup li:last-child { border-bottom: 0; }
.setup__mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.setup li.is-done .setup__mark { background: var(--success); border-color: var(--success); color: #fff; }
.setup li.is-done .setup__title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.setup li.is-next { background: var(--primary-soft); margin: 0 -12px; padding: 10px 12px; border-radius: var(--r-md); border-bottom-color: transparent; }
.setup li.is-next .setup__mark { border-color: var(--primary); }
.setup__title { font-weight: 600; }
.setup__hint { font-size: 12px; color: var(--text-3); }

/* ---------- Тур обучения ---------- */
.tour-shade { position: fixed; inset: 0; z-index: var(--z-tour); pointer-events: auto; }
.tour-spot { position: fixed; z-index: calc(var(--z-tour) + 1); border-radius: var(--r-lg); box-shadow: 0 0 0 4px rgba(79, 209, 193, .85), 0 0 0 9999px rgba(8, 16, 28, .62); transition: all var(--dur-3) var(--ease); pointer-events: none; }
.tour-pop { position: fixed; z-index: calc(var(--z-tour) + 2); width: min(360px, calc(100vw - 24px)); background: var(--surface); color: var(--text); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 18px; border: 1px solid var(--border); transition: top var(--dur-3) var(--ease), left var(--dur-3) var(--ease); }
.tour-pop__step { font-size: 12px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .06em; }
.tour-pop h3 { font-size: 17px; margin: 6px 0 6px; }
.tour-pop p { color: var(--text-2); font-size: 14px; }
.tour-pop__foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.tour-dots { display: flex; gap: 5px; margin-right: auto; }
.tour-dots b { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.tour-dots b.is-on { background: var(--primary); width: 16px; border-radius: 4px; }

/* ---------- Канбан ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 200px; max-height: 72vh; }
.kcol__head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 700; }
.kcol__head .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 600; }
.kcol__hint { padding: 0 12px 8px; font-size: 12px; color: var(--text-3); }
.kcol__list { flex: 1; overflow-y: auto; padding: 4px 8px 10px; display: grid; gap: 8px; align-content: start; min-height: 80px; border-radius: var(--r-md); transition: background var(--dur-1); }
.kcol__list.is-over { background: var(--primary-soft); outline: 2px dashed var(--primary); outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--shadow-xs); cursor: grab; display: grid; gap: 8px; }
.kcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kcard.is-dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard:active { cursor: grabbing; }
.kcard__top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.kcard__title { font-weight: 600; line-height: 19px; }
.kcard__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.kcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Список (общий) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list__icon { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.list__icon--danger { background: var(--danger-soft); color: var(--danger-text); }
.list__icon--warning { background: var(--warning-soft); color: var(--warning-text); }
.list__icon--success { background: var(--success-soft); color: var(--success-text); }
.list__icon--primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.list__icon--accent { background: var(--accent-soft); color: var(--accent-text); }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; }
.list__sub { font-size: 13px; color: var(--text-2); }
.list__meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* Описание «ключ — значение» */
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- ИИ-помощник ---------- */
.ai-card { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.ai-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.src { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text); text-decoration: none; }
.src:hover { border-color: var(--accent); text-decoration: none; }
.src__n { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; flex: none; }
.src small { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; vertical-align: 1px; text-decoration: none; }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg__bubble { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; max-width: 760px; }
.msg--me { flex-direction: row-reverse; }
.msg--me .msg__bubble { background: var(--primary); color: var(--text-inverse); border-color: transparent; }
.msg__bubble p + p, .msg__bubble p + ol, .msg__bubble ol + p { margin-top: 8px; }
.msg__bubble ol { margin: 8px 0 0; padding-left: 20px; }
.ai-av { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, #12a594, #2a78d6); color: #fff; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; min-height: 40px; max-height: 160px; padding: 8px; outline: none; }
.composer:focus-within { border-color: var(--primary); box-shadow: var(--focus-ring); }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Графики ---------- */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { overflow: visible; }
.chart text { font-family: var(--font); fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; opacity: .9; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-size: 12px; color: var(--text); white-space: nowrap; opacity: 0; transition: opacity var(--dur-1); }
.chart-tip.is-show { opacity: 1; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 2px; width: 14px; }

/* Схема объектов (карта) */
.objmap { position: relative; border-radius: var(--r-md); overflow: hidden; background: radial-gradient(120% 90% at 30% 20%, var(--surface-2), var(--surface-3)); }
.objmap { overflow-x: auto; }
.objmap svg { width: 100%; height: auto; min-width: 460px; }
.objmap .region { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.objmap .river { fill: none; stroke: color-mix(in srgb, var(--info) 35%, transparent); stroke-width: 3; }
.objmap .road { fill: none; stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 4; }
.objmap .node { cursor: pointer; }
.objmap .node circle.halo { opacity: .2; }
.objmap .node text { font-size: 11px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.objmap .node:hover circle.core, .objmap .node:focus circle.core { stroke: var(--text); stroke-width: 2; }

/* ---------- Календарь ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal__dow { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal__day { min-height: 118px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background var(--dur-1); }
.cal__day.is-out { background: var(--surface-2); }
.cal__day.is-out .cal__num { color: var(--text-3); opacity: .6; }
.cal__day.is-weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal__day.is-over { background: var(--primary-soft); }
.cal__num { font-size: 12px; font-weight: 600; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal__day.is-today .cal__num { background: var(--primary); color: var(--text-inverse); }
.ev { display: flex; align-items: center; gap: 6px; padding: 3px 7px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 16px; background: var(--primary-soft); color: var(--primary-soft-text); border-left: 3px solid var(--primary); cursor: grab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ev span { overflow: hidden; text-overflow: ellipsis; }
.ev--late { background: var(--danger-soft); color: var(--danger-text); border-left-color: var(--danger); }
.ev--done { background: var(--success-soft); color: var(--success-text); border-left-color: var(--success); }
.ev--verify { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); }
.ev--warn { background: var(--warning-soft); color: var(--warning-text); border-left-color: var(--warning); }
.ev.is-dragging { opacity: .45; }
.ev-more { font-size: 12px; color: var(--text-3); padding-left: 4px; }
.board { display: grid; grid-template-columns: 200px repeat(5, minmax(150px, 1fr)); min-width: 980px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.board > div { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; min-height: 92px; display: flex; flex-direction: column; gap: 6px; }
.board__head { min-height: 0 !important; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }
.board__head.is-today { color: var(--primary); }
.board__eng { flex-direction: row !important; align-items: center; gap: 10px !important; }
.board__eng b { display: block; font-size: 13px; }
.board__eng small { font-size: 12px; color: var(--text-3); }
.board .is-over { background: var(--primary-soft); }
.load { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 4px; width: 100px; }
.load span { display: block; height: 100%; background: var(--success); }
.load--warn span { background: var(--warning); } .load--over span { background: var(--danger); }
.bev { padding: 6px 8px; border-radius: 6px; font-size: 12px; line-height: 16px; background: var(--primary-soft); color: var(--primary-soft-text); border-left: 3px solid var(--primary); cursor: grab; }
.bev b { display: block; font-weight: 600; }
.bev small { color: inherit; opacity: .85; }
.bev--late { background: var(--danger-soft); color: var(--danger-text); border-left-color: var(--danger); }
.bev--verify { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); }
.bev--repair { background: var(--warning-soft); color: var(--warning-text); border-left-color: var(--warning); }
.bev.is-dragging { opacity: .45; }

/* ---------- Фото и подпись ---------- */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo { aspect-ratio: 1; border-radius: var(--r-md); background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); position: relative; overflow: hidden; }
.photo svg.art { width: 100%; height: 100%; }
.photo--add { border: 2px dashed var(--border-strong); background: var(--surface); color: var(--primary); cursor: pointer; font-size: 12px; font-weight: 600; gap: 4px; align-content: center; }
.photo small { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; }
.sign-pad { position: relative; height: 180px; border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); touch-action: none; }
.sign-pad canvas { width: 100%; height: 100%; display: block; border-radius: inherit; cursor: crosshair; }
.sign-pad__hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); pointer-events: none; font-size: 14px; }
.sign-pad__line { position: absolute; left: 20px; right: 20px; bottom: 40px; border-bottom: 1px solid var(--border-strong); pointer-events: none; }

/* Плашки-уведомления на странице */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid transparent; font-size: 14px; }
.alert b { display: block; }
.alert--info { background: var(--info-soft); color: var(--info-text); }
.alert--warning { background: var(--warning-soft); color: var(--warning-text); }
.alert--danger { background: var(--danger-soft); color: var(--danger-text); }
.alert--success { background: var(--success-soft); color: var(--success-text); }
.alert p { color: var(--text-2); }

/* Дедлайны тендеров */
.deadline { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: var(--r-lg); background: var(--surface-3); flex: none; line-height: 1; }
.deadline b { font-size: 22px; font-weight: 700; }
.deadline small { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.deadline--danger { background: var(--danger-soft); color: var(--danger-text); }
.deadline--warning { background: var(--warning-soft); color: var(--warning-text); }
.deadline--ok { background: var(--success-soft); color: var(--success-text); }
.deadline--danger small, .deadline--warning small, .deadline--ok small { color: inherit; }

/* Воронка */
.funnel { display: grid; gap: 6px; }
.funnel__row { display: grid; grid-template-columns: 160px 1fr 120px; gap: 12px; align-items: center; font-size: 13px; }
.funnel__bar { height: 30px; border-radius: 6px; background: var(--primary); display: flex; align-items: center; padding: 0 10px; color: var(--text-inverse); font-weight: 600; font-size: 12px; min-width: 40px; }
@media (max-width: 767px) { .funnel__row { grid-template-columns: 1fr; gap: 4px; } }

/* Индикатор риска */
.risk { display: grid; justify-items: center; gap: 4px; }
.risk__val { font-size: 32px; font-weight: 700; line-height: 1; }

/* =====================================================================
   Визуальный слой 2.0: карточки, кнопки, KPI, анимации появления
   ===================================================================== */
.card { border-color: var(--card-border); box-shadow: var(--shadow-card); }
.card__head { border-bottom-color: var(--card-border); }
.card__foot { border-top-color: var(--card-border); }
.card--hover:hover, a.card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.btn--primary { background: var(--brand-grad-btn); border-color: transparent; box-shadow: var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.18); }
.btn--primary:hover { background: var(--brand-grad-btn); filter: brightness(1.07); border-color: transparent; }
.kpi { padding: 18px; gap: 8px; }
.kpi__value { font-size: 32px; line-height: 38px; letter-spacing: -0.03em; }
.kpi__icon { border-radius: 10px; }
.table th { background: color-mix(in srgb, var(--surface-2) 85%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.table td { border-bottom-color: var(--card-border); }
.list > li, .attn li { border-bottom-color: var(--card-border); }
.ai-card { background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), var(--surface) 55%); }
.ai-av { background: var(--brand-grad); }
.progress:not(.progress--success):not(.progress--warning):not(.progress--danger) > span { background: var(--brand-grad); }

/* Появление карточек и счётчики (отключаются prefers-reduced-motion) */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.content > *, .stack > .card, .grid > .card, .grid > section { animation: rise .5s var(--ease) both; }
.grid > *:nth-child(2) { animation-delay: .04s; } .grid > *:nth-child(3) { animation-delay: .08s; }
.grid > *:nth-child(4) { animation-delay: .12s; } .grid > *:nth-child(5) { animation-delay: .16s; } .grid > *:nth-child(6) { animation-delay: .2s; }
.is-new { animation: flash 1.6s var(--ease) 2; }
@keyframes flash { 0%, 100% { box-shadow: inset 3px 0 0 var(--danger); } 50% { box-shadow: inset 3px 0 0 var(--danger), 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent); background: var(--danger-soft); } }

/* Карта: пульс проблемных объектов */
.objmap { background: radial-gradient(90% 90% at 40% 30%, color-mix(in srgb, var(--primary-soft) 70%, var(--surface)), var(--surface-2)); border: 1px solid var(--card-border); }
.objmap .pulse { transform-box: fill-box; transform-origin: center; animation: mpulse 2.2s var(--ease) infinite; }
@keyframes mpulse { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }

/* Разложение себестоимости */
.costbar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; }
.costbar span { display: block; }
i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Иллюстрации аппаратов */
.illo { color: var(--primary); }
.illo .illo-accent { color: var(--accent); }
.illo-tile { display: grid; place-items: center; flex: none; width: 128px; height: 88px; border-radius: 18px; color: var(--primary); background: radial-gradient(120% 120% at 20% 0%, var(--primary-soft), var(--surface-2)); border: 1px solid var(--card-border); }
.illo-tile--danger { color: var(--danger); background: radial-gradient(120% 120% at 20% 0%, var(--danger-soft), var(--surface-2)); }
.empty__art--illo { width: 160px; height: 104px; border-radius: 22px; }
.empty__art--illo svg { width: 132px; height: 88px; }
.table .sla { flex-wrap: wrap; white-space: normal; row-gap: 2px; max-width: 190px; }
.table .sla small { flex-basis: 100%; padding-left: 38px; line-height: 15px; }
.table td.cell-wide { min-width: 280px; }
.table td.cell-mid { min-width: 210px; }

/* =====================================================================
   Экран входа (login), первый запуск (start), «О программе» (about)
   Перенесено из страниц прототипа: на страницах нет <style> и style="".
   ===================================================================== */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.login__brand { position: relative; overflow: hidden; color: #e8f0fa; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; isolation: isolate;
  background: radial-gradient(60% 50% at 85% 75%, rgba(18, 165, 148, .45), transparent 70%), radial-gradient(70% 60% at 10% 0%, rgba(42, 120, 214, .65), transparent 70%), linear-gradient(160deg, #0d2442 0%, #081627 100%); }
.login__brand::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 36px 36px; -webkit-mask-image: radial-gradient(80% 70% at 60% 60%, #000, transparent); mask-image: radial-gradient(80% 70% at 60% 60%, #000, transparent); }
.login__logo { display: flex; align-items: center; gap: 12px; }
.login__logo .logo { width: 40px; height: 40px; }
.login__logo b { font-size: 17px; color: #fff; }
.login__lead { display: grid; gap: 16px; }
.login__brand h1 { color: #fff; font-size: 34px; line-height: 42px; max-width: 520px; }
.login__brand p { color: #b9c9de; font-size: 16px; line-height: 24px; max-width: 520px; }
.login__hero { position: relative; height: 300px; max-width: 560px; }
.login__hero .illo { position: absolute; left: 0; top: 10px; color: rgba(214, 232, 255, .92); filter: drop-shadow(0 0 18px rgba(79, 209, 193, .35)); }
.login__hero .illo .illo-accent { color: #4fd1c1; }
.glass { position: absolute; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); color: #e8f0fa; font-size: 13px; }
.glass b { display: block; font-size: 14px; color: #fff; margin-top: 6px; }
.glass small { color: #b9c9de; }
.glass .big { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -0.02em; line-height: 1.1; }
.glass__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.glass--a { right: 0; top: 0; }
.glass--b { right: 40px; bottom: 0; width: 220px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: #7ee2b0; font-weight: 600; font-size: 12px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3cbf74; box-shadow: 0 0 0 4px rgba(60, 191, 116, .25); }
.login__feat { display: grid; gap: 14px; max-width: 520px; }
.login__feat div { display: flex; gap: 12px; align-items: flex-start; color: #d6e2f1; }
.login__feat .ico { color: #4fd1c1; margin-top: 2px; }
.login__form { display: flex; flex-direction: column; justify-content: center; padding: 48px; background: var(--surface); }
.login__box { width: 100%; max-width: 380px; margin: 0 auto; display: grid; gap: 18px; }
.login__title { font-size: 24px; line-height: 32px; }
.login__links { font-size: 13px; }
.login__note { font-size: 13px; }
.login__copy { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 28px; }
.login__copy a { color: var(--text-3); text-decoration: underline; }
@media (max-width: 1200px) { .glass--a { display: none; } }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__brand { padding: 28px 20px; gap: 20px; }
  .login__brand h1 { font-size: 24px; line-height: 30px; }
  .login__feat, .login__brand p, .glass { display: none; }
  .login__hero { height: 120px; }
  .login__hero .illo { width: 190px; height: 119px; top: 0; }
  .login__form { padding: 28px 20px; justify-content: flex-start; }
}

.st { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; gap: 32px; background: radial-gradient(60% 45% at 50% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%), radial-gradient(40% 40% at 90% 90%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
.st h1 { font-size: 34px; line-height: 42px; letter-spacing: -0.025em; }
.st__head { text-align: center; display: grid; gap: 10px; justify-items: center; }
.st__head .logo { width: 48px; height: 48px; border-radius: 14px; }
.st__head p { max-width: 560px; color: var(--text-2); }
.st__cards { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 20px; }
.st__card { display: grid; gap: 14px; align-content: start; padding: 28px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--border); box-shadow: var(--shadow-md); color: inherit; text-decoration: none; transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2), border-color var(--dur-2); }
.st__card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; }
.st__card.is-main { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.st__card h2 { font-size: 22px; line-height: 28px; }
.st__card ul { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 4px; font-size: 14px; }
.st__art { height: 120px; display: grid; place-items: center; margin: -8px 0 4px; border-radius: 16px; background: radial-gradient(100% 120% at 50% 0%, var(--primary-soft), transparent); color: var(--primary); }
.st__art--b { background: radial-gradient(100% 120% at 50% 0%, var(--accent-soft), transparent); color: var(--accent); }
.st__copy { font-size: 12px; color: var(--text-3); }
@media (max-width: 767px) { .st__cards { grid-template-columns: 1fr; width: 100%; } .st { justify-content: flex-start; } .st h1 { font-size: 26px; line-height: 32px; } }

.about { max-width: 820px; }
.about__card { display: grid; gap: 20px; padding: 28px; }
.about__head { display: flex; gap: 16px; align-items: center; }
.about__head .logo { width: 56px; height: 56px; border-radius: 16px; }
.about__head h2 { font-size: 22px; line-height: 28px; }
.about__copy { font-size: 13px; color: var(--text-3); }

/* ---------- Загрузка инженера: <meter class="load" min max low high optimum value> ----------
   optimum < low: значение ≤ low — норма (зелёный), между low и high — высокая (жёлтый), > high — перегрузка (красный) */
meter.load { -webkit-appearance: none; appearance: none; display: block; width: 100px; height: 6px; margin-top: 4px; border: 0; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
meter.load::-webkit-meter-inner-element { display: block; }
meter.load::-webkit-meter-bar { background: var(--surface-3); border: 0; border-radius: 4px; height: 6px; }
meter.load::-webkit-meter-optimum-value { background: var(--success); border-radius: 4px; }
meter.load::-webkit-meter-suboptimum-value { background: var(--warning); border-radius: 4px; }
meter.load::-webkit-meter-even-less-good-value { background: var(--danger); border-radius: 4px; }
meter.load::-moz-meter-bar { background: var(--success); border-radius: 4px; }
meter.load:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warning); }
meter.load:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--danger); }
meter.load--wide { width: 100%; }

/* ---------- Графики: цвета рядов классами (без style="" — совместимо с CSP) ---------- */
.c-s1 { --c: var(--series-1); } .c-s2 { --c: var(--series-2); } .c-s3 { --c: var(--series-3); } .c-s4 { --c: var(--series-4); }
.c-primary { --c: var(--primary); } .c-accent { --c: var(--accent); } .c-info { --c: var(--info); }
.c-success { --c: var(--success); } .c-warning { --c: var(--warning); } .c-danger { --c: var(--danger); } .c-muted { --c: var(--surface-3); }
.legend i[class*="c-"], .chart-tip i[class*="c-"], .donut__name i[class*="c-"] { background: var(--c); }
.legend--chart { margin-bottom: 8px; }
.chart-tip strong { font-weight: 700; }
.chart .mk-line { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .mk-halo { fill: var(--c); opacity: .16; }
.chart .mk-dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.chart .mk-cross { stroke: var(--border-strong); stroke-width: 1; opacity: 0; }
.chart .mk-cross.is-on { opacity: 1; }
.chart .hit { fill: transparent; }
.chart .hit--bar.is-on { fill: var(--surface-3); fill-opacity: .5; }
.chart .mk-arc { fill: none; stroke: var(--c); cursor: pointer; }
.chart .donut__track { fill: none; stroke: var(--surface-3); }
.chart .donut__val { font-size: 24px; font-weight: 700; fill: var(--text); }
.chart .donut__lbl { font-size: 11px; }
.mk-spark { fill: none; stroke: var(--c); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.mk-fill { fill: var(--c); }
.donut { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.donut__svg { flex: none; }
.donut__legend { display: grid; gap: 8px; min-width: 0; flex: 1 1 200px; }
.donut__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.donut__name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.donut__name i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat { overflow-x: auto; }
.heat__table { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 360px; }
.heat__col { font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; padding: 0 0 2px; }
.heat__row { text-align: left; font-weight: 500; font-size: 13px; white-space: nowrap; padding-right: 8px; }
.heat__cell { height: 34px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 600; cursor: default; }
.heat__legend { margin-top: 10px; }
.hm-0 { background: var(--seq-0); color: var(--text); } .hm-1 { background: var(--seq-1); color: var(--text); } .hm-2 { background: var(--seq-2); color: var(--text); }
.hm-3 { background: var(--seq-3); color: #0b1a2e; } .hm-4 { background: var(--seq-4); color: #fff; } .hm-5 { background: var(--seq-5); color: #fff; }
.hm-over { background: var(--danger); color: var(--text-inverse); }
:root[data-theme="dark"] .hm-3 { color: #fff; }
:root[data-theme="dark"] .hm-4, :root[data-theme="dark"] .hm-5 { color: #0d1218; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hm-3 { color: #fff; } :root:not([data-theme="light"]) .hm-4, :root:not([data-theme="light"]) .hm-5 { color: #0d1218; } }

/* ---------- Служебные классы ядра ui.js (вместо style="" — совместимо с CSP) ---------- */
.modal__titles, .drawer__titles { flex: 1; min-width: 0; }
.help__h { margin: 24px 0 10px; }
.state-line { display: inline-flex; align-items: center; gap: 6px; }
.palette__empty { padding: 28px; }
.empty--lg { padding: 56px 20px; }
.side__count { font-style: normal; }
.src-list { display: grid; gap: 6px; margin-left: 42px; }
.btn--block-start { width: 100%; justify-content: flex-start; }
.composer--grow { flex: 1; }
.menu__item--top { align-items: flex-start; }
.menu__title { display: block; font-weight: 600; }
.list__icon--sm { width: 30px; height: 30px; }
.chart.chart--inline { width: auto; flex: none; }
.table .sla:not(:has(small)) { flex-wrap: nowrap; white-space: nowrap; }

/* ---------- Поля ввода на телефоне (H-051): Safari на iPhone увеличивает страницу при фокусе на поле
   со шрифтом меньше 16 px. На узком экране и сенсорном вводе шрифт полей — не меньше 16 px. ---------- */
@media (max-width: 768px), (pointer: coarse) {
  .input, .select, .textarea,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]),
  select, textarea { font-size: 16px; }
}
