@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* MCAsicWatch — on-brand dark theme (Mining Cluster). Имена классов/переменных сохранены как в коде:
   редизайн меняет ЗНАЧЕНИЯ (палитра → бренд) и шрифты, не структуру. См. design foundation v2. */
:root {
    /* ─── Brand / accent ─── */
    --accent: #2187FF;
    --accent-hover: #1B74E0;
    --accent-ring: rgba(33, 135, 255, .20);
    --on-accent: #FFFFFF;

    /* ─── Surfaces (бренд-тёмный #202226) ─── */
    --bg: #16181C;
    --panel: #202226;
    --panel-2: #2A2D33;
    --border: #363A42;

    /* ─── Text ─── */
    --text: #F1F1F1;
    --muted: #9097A1;

    /* ─── Status ─── */
    --online: #27C06A;
    --degraded: #F5A623;
    --offline: #FF5A60;
    --online-bg: rgba(39, 192, 106, .15);
    --degraded-bg: rgba(245, 166, 35, .15);
    --offline-bg: rgba(255, 90, 96, .15);
    --poweredoff-bg: rgba(144, 151, 161, .15);

    --row-hover: rgba(33, 135, 255, .06);
    --chart-temp: #FC9840;

    /* ─── Typography ─── */
    --font-display: "Actay Wide", system-ui, sans-serif;
    --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    /* ─── Radius / shadows ─── */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-brand: 14px;
    --radius-pill: 20px;
    --shadow-tip: 0 4px 14px rgba(0, 0, 0, .4);
    --shadow-menu: 0 12px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 20px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* числовые ячейки и оси графиков — табличные цифры (критично для real-time, чтобы не «прыгали») */
.stat .num, .cnts .cnt b, .hrs .hr b, td, .pct, .serial-val, .serial-input,
.ch-lbl, .twofa, .tnum { font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.005em;
    color: inherit; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
/* Значок BIT EYE в шапке + подпись «BIT EYE» справа, далее «· Центральная CRM». */
.topbar .brand .brand-mark { height: 60px; width: auto; display: block; }
.topbar .brand .brand-name { color: #fff; }
.topbar .user { color: var(--muted); font-size: 14px; }
.topbar form { display: inline; margin-left: 14px; }

.container { max-width: 1180px; margin: 0 auto; padding: 28px; }
/* страница со списком всех ASIC — шире, чтобы воркеры/стратумы читались */
.container.wide { max-width: 1500px; }
/* список пользователей — ещё шире: колонка «Действия» с набором кнопок не теснится */
.container.wide.users-list { max-width: 1760px; }
/* страница контейнера — таблица устройств на всю ширину экрана (только эта страница) */
body[data-refresh="container"] .container.wide { max-width: none; }
/* таблица пользователей: имя/email/роль не переносим, действия — компактным рядом с переносом */
.users-list table td, .users-list table th { vertical-align: middle; }
.users-list td .btn { white-space: nowrap; }

.crumbs { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

h1 { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 16px; color: var(--muted); font-weight: 500; margin: 0 0 22px; }

.stats { display: flex; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.stat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    min-width: 150px;
}
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.grid.single { grid-template-columns: 1fr; }
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: border-color .15s, background .15s;
}
.card:hover { border-color: var(--accent); background: var(--row-hover); }
.card .title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.card .row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.card .row .k { color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius-lg); overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--row-hover); }

.badge { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.badge.ONLINE { background: var(--online-bg); color: var(--online); }
.badge.DEGRADED { background: var(--degraded-bg); color: var(--degraded); }
.badge.OFFLINE { background: var(--offline-bg); color: var(--offline); }
.badge.POWERED_OFF { background: var(--poweredoff-bg); color: var(--muted); }
/* «Оффлайн по аптайму» — плановое отключение по графику: синий (информативный, не авария). */
.badge.UPTIME_OFFLINE { background: rgba(33, 135, 255, .15); color: var(--accent); }
/* Журнал: WARN (несобираемое железо) — красный, INFO (авто-добавление) — жёлтый/амбер. */
.badge.sev-warn { background: var(--offline-bg); color: var(--offline); }
.badge.sev-info { background: var(--degraded-bg); color: var(--degraded); }

/* Вкладки таблицы контейнера (Активные / Архив) */
.tabs { display: flex; gap: 6px; margin: 18px 0 0; }
.tab-btn {
    background: transparent; color: var(--muted); border: 1px solid var(--border); border-bottom: none;
    border-radius: 8px 8px 0 0; padding: 8px 16px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab-btn.active { color: var(--accent); border-color: var(--accent); background: var(--panel); }
.tab-btn b { margin-left: 4px; }
.tab-panel { display: none; }
/* Активная панель таблицы (устройства контейнера/площадки) — горизонтальный скролл при нехватке
   ширины, чтобы длинные значения (серийник/стратум) не выталкивали таблицу за пределы экрана. */
.tab-panel.active { display: block; overflow-x: auto; }

.pct.low { color: var(--degraded); font-weight: 600; }
.pct.dead { color: var(--offline); font-weight: 600; }

/* Иконка здоровья в столбце статуса: ⚠ (есть проблемы, тултип) / ✓ (норма) */
.hi { display: inline-flex; vertical-align: middle; margin-right: 6px; }
.hi .hi-icon { display: block; }
.hi.warn { cursor: help; }
/* статус + иконка в одну строку */
.cell-status { white-space: nowrap; }
.cell-status .badge { vertical-align: middle; }
/* Глобальный тумблер автоперезагрузки в шапке админа */
.reboot-toggle.on { color: var(--online); border-color: var(--online); }
.reboot-toggle.off { color: var(--offline); border-color: var(--offline); }
/* Иконка состояния автоперезагрузки в строке/попапе */
.reboot-ico { margin-left: 6px; font-size: 13px; vertical-align: middle; cursor: default; }
.reboot-ico.on { opacity: .5; }
.reboot-ico.off { opacity: 1; }
/* Статус автоперезагрузки — пилюля-бейдж (в попапе мониторинга и в drawer'е журнала). */
.d-reboot { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px;
    border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.d-reboot.reboot-off { color: var(--offline); background: var(--offline-bg); }
.d-reboot.reboot-on { color: var(--online); background: var(--online-bg); }
/* Поле «Мониторинг устройства» в drawer'е журнала: подпись + пилюля статуса, ниже — кнопка попапа. */
.dw-mon { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dw-mon-k { font-size: 13px; color: var(--muted); }
.manage-reboot .rb-excl-lbl { display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text); cursor: pointer; }
/* Чекбокс автоперезагрузки в общем стиле приложения (акцентный, как фильтры/календарь режимов). */
.manage-reboot .rb-excl { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent);
    margin: 0; }
/* вся строка ASIC кликабельна (открывает попап) */
tr.asic-row { cursor: pointer; }

/* счётчики по статусам и хешрейт по алгоритмам (страница контейнера) */
.cnts { display: flex; gap: 18px; flex-wrap: wrap; margin: -10px 0 14px; font-size: 14px; }
.cnts .cnt { color: var(--muted); }
.cnts .cnt b { color: var(--text); font-size: 15px; font-weight: 700; margin-left: 4px; }
.cnts .cnt.ok b { color: var(--online); }
.cnts .cnt.warn b { color: var(--degraded); }
.cnts .cnt.bad b { color: var(--offline); }
.cnts .cnt.uptime b { color: var(--accent); }

.hrs { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 20px; }
.hrs .hr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    font-size: 14px;
}
.hrs .hr .algo { color: var(--muted); margin-right: 8px; }
.hrs .hr b { font-size: 16px; font-weight: 700; }

/* столбец «Воркеры / стратумы» — до 3 строк, моноширинный, узкие переносы */
td.pools { max-width: 320px; }
td.pools .pool { line-height: 1.25; padding: 1px 0; }
td.pools .pool + .pool { border-top: 1px dashed var(--border); margin-top: 2px; padding-top: 3px; }
td.pools .pw { font-weight: 600; margin-right: 6px; }
td.pools .pu { color: var(--muted); font-family: var(--font-mono);
    font-size: 12px; word-break: break-all; }

.btn {
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid transparent;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { opacity: .9; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-brand);
    padding: 36px;
    width: 360px;
}
.login-box .logo { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-box .logo span { color: var(--accent); }
/* Логотип BIT EYE на входе/2FA/входе в смену — SVG вместо текста. */
.logo .logo-img { height: 240px; width: auto; display: inline-block; }
.login-box .tag { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 11px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 14px;
    transition: border-color .12s, box-shadow .12s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-box .btn { width: 100%; margin-top: 6px; }
/* Второй фактор (WebAuthn passkey): страницы /2fa/* поверх стиля login-box. */
.wa-lead { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 18px; }
.wa-status { min-height: 18px; font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }
/* Инлайн-вариант для таблицы (кнопка «+ Passkey» в ячейке «Действия» журнала пользователей). */
.wa-status--inline { display: inline-block; min-height: 0; margin: 0 0 0 8px; text-align: left; vertical-align: middle; }
.wa-status.err { color: var(--offline); }
.wa-status.ok { color: var(--online); }
.wa-foot { display: flex; justify-content: space-between; margin-top: 18px; font-size: 13px; }
.wa-foot a, .wa-foot button { color: var(--accent); text-decoration: none; }
/* «Выйти» — это POST-форма (logout требует POST+CSRF), кнопку рисуем как текстовую ссылку. */
.wa-foot form { margin: 0; }
.wa-foot button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.wa-guide { margin: 4px 0 18px; font-size: 13px; text-align: left; }
.wa-guide summary { color: var(--accent); cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.wa-guide p { color: var(--muted); line-height: 1.5; margin: 8px 0; }
.wa-guide ol { color: var(--text); line-height: 1.6; padding-left: 20px; margin: 8px 0; }
.wa-guide ul { color: var(--muted); margin: 4px 0 4px; padding-left: 18px; }
.wa-guide code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 5px; }
.wa-guide .wa-note { font-size: 12px; }
.static-field { padding: 9px 2px; color: var(--text); font-weight: 500; }
.alert { background: var(--offline-bg); color: var(--offline); padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; }
.notice { background: var(--online-bg); color: var(--online); padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; }
.hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* collector settings */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    margin-bottom: 22px;
}
.panel h3 { margin: 0 0 16px; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h3 { margin: 0; }

/* Форма создания/редактирования пользователя: узкая центрированная колонка, поля в столбик с
   ровными отступами, подсказки/действия — классами (без inline-стилей), как у прочих форм CRM. */
.user-form { max-width: 720px; }
.user-form .panel { margin-bottom: 18px; }
.form-note { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.field-hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.form-actions { display: flex; gap: 12px; margin-top: 4px; }

.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 18px; align-items: end; }
.add-row { display: grid; grid-template-columns: 2fr 2fr auto; gap: 14px 18px; align-items: end; margin-top: 18px;
    border-top: 1px solid var(--border); padding-top: 18px; }
.cfg-grid .field, .add-row .field { margin-bottom: 0; }
.field.end { display: flex; align-items: flex-end; }
.field.check { display: flex; align-items: center; }
.field.check label { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 0; }
.field input[type="number"], .field input[type="text"] {
    width: 100%; padding: 10px 12px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.actions { display: flex; gap: 8px; }
.actions form { display: inline; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--accent); opacity: 1; }
.btn.danger { background: transparent; color: var(--offline); border: 1px solid var(--offline); }
.btn.danger:hover { background: var(--offline-bg); opacity: 1; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
td.muted { color: var(--muted); text-align: center; padding: 18px; }
code { background: var(--panel-2); padding: 2px 7px; border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font-mono); }

a.btn { display: inline-block; text-decoration: none; }
a.btn:hover { text-decoration: none; }

/* ---- Попап графиков устройства (хешрейт + онлайн) ---- */
.chart-btn { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
body.modal-open { overflow: hidden; }

.chart-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(5, 10, 18, .72);
    display: none; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.chart-overlay.open { display: flex; }
.chart-modal {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius-brand); padding: 20px 22px; width: 820px; max-width: 100%;
}
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.chart-title { font-size: 17px; font-weight: 700; }
.chart-close { padding: 6px 11px; font-size: 15px; line-height: 1; }
.chart-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.chart-tabs .period.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chart-block { margin-bottom: 18px; }
.chart-h { font-size: 14px; margin-bottom: 6px; }
.chart-h .muted { font-weight: 400; }
.chart-canvas { position: relative; width: 100%; }
.chart-empty { padding: 40px 0; text-align: center; }

.ch-svg { display: block; width: 100%; height: auto; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-lbl { fill: var(--muted); font-size: 11px; }
.ch-lbl-temp { fill: var(--chart-temp); }
.ch-area { fill: var(--accent); opacity: .14; stroke: none; }
.ch-line { fill: none; stroke-width: 2; }
.ch-line-hash { stroke: var(--accent); }
.ch-line-temp { stroke: var(--chart-temp); }
.ch-nominal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 4; }
.ch-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-marker { stroke: var(--panel); stroke-width: 1.5; }
.ch-marker-hash { fill: var(--accent); }
.ch-marker-temp { fill: var(--chart-temp); }
.ch-tip {
    position: absolute; pointer-events: none; z-index: 2;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 6px 9px; font-size: 12px; white-space: nowrap;
    box-shadow: var(--shadow-tip); transition: opacity .08s;
}
.ch-tip b { display: block; font-size: 13px; margin-bottom: 2px; }
.ch-tip span { display: block; color: var(--muted); }
.ch-tip .t-hash { color: var(--accent); }
.ch-tip .t-temp { color: var(--chart-temp); }

/* Легенда над графиком */
.ch-legend { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.ch-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
    margin: 0 4px 0 10px; vertical-align: middle; }
.ch-legend .lg-hash { background: var(--accent); }
.ch-legend .lg-temp { background: var(--chart-temp); }
.ch-legend .lg-nom { width: 12px; height: 0; border-radius: 0; border-top: 2px dashed var(--muted); }

.chart-foot { font-size: 12px; margin-top: 4px; }

/* Детали устройства в попапе (перенесённые из таблицы вентилятор/мощность и пр.) */
.chart-detail {
    margin-bottom: 16px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px;
}
.chart-detail .d-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.chart-detail .d-item { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.chart-detail .d-k { color: var(--muted); font-size: 12px; }
.chart-detail .d-v { font-weight: 600; }
.chart-detail .boards { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.chart-detail .boards-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.chart-detail .boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 5px 14px; }
.chart-detail .board { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.chart-detail .board .b-i { color: var(--muted); }
.chart-detail .board .b-v { font-weight: 600; }
.chart-detail .problems { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.chart-detail .problems-h { font-size: 12px; font-weight: 600; color: var(--degraded); margin-bottom: 6px; }
.chart-detail .problems ul { margin: 0; padding-left: 18px; }
.chart-detail .problems li { font-size: 13px; padding: 1px 0; }

/* ---- Фильтр-бар и сортируемые заголовки таблицы ASIC ---- */
.filterbar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 14px 16px; margin-bottom: 14px;
}
.filterbar .fld { display: flex; flex-direction: column; gap: 4px; }
.filterbar .fld label { font-size: 12px; color: var(--muted); }
.filterbar input, .filterbar select {
    padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text); font-size: 14px; min-width: 160px;
}
.filterbar input:focus, .filterbar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.filterbar .btn { padding: 8px 14px; }
.filterbar .shown { margin-left: auto; align-self: center; font-size: 13px; }
/* Чекбоксы статей в форме выгрузки журнала. Внутри .filterbar они иначе унаследовали бы
   оформление текстовых полей (.filterbar input: рамка/фон/паддинг/min-width — те для дат/текста),
   и выпадали из общего дизайна. Сбрасываем наследование и оформляем как остальные чекбоксы
   приложения (ср. .chk input) — нативный квадрат с бренд-акцентом на тёмной теме. */
.filterbar .checks { flex-direction: row; }
.filterbar .check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.filterbar .check input[type="checkbox"] {
    min-width: 0; width: auto; margin: 0; padding: 0;
    background: none; border: 0; border-radius: 0;
    accent-color: var(--accent); cursor: pointer;
}

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--accent); }
.sort-ind { font-size: 11px; }

/* ---- Журнал администратора ---- */
.topbar .user .btn.ghost.sm { margin-right: 4px; }
.cell-sub { color: var(--muted); font-family: var(--font-mono);
    font-size: 12px; }
/* Смена ИМЕНИ аккаунта при смене пулов — подсветка описания красным. */
.acct-changed { color: var(--offline); font-weight: 600; }
/* Описание статьи журнала: сохраняем переводы строк (примечание «Автокорректировка воркера по IP»
   дописывается к «Смене пулов» с новой строки). pre-line: \n переносит, лишние пробелы схлопываются. */
.j-sum { white-space: pre-line; }
.pager { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

/* ---- Управление пользователями ---- */
.badge.role { background: rgba(33, 135, 255, .15); color: var(--accent); }
.field textarea {
    width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text); font-size: 14px; resize: vertical;
    font-family: var(--font-mono); transition: border-color .12s, box-shadow .12s;
}
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
/* Выпадающий список в полях формы — единый стиль с .field input (тёмная тема, своя стрелка). */
.field select, .field .select {
    width: 100%; padding: 11px 36px 11px 12px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text);
    font-size: 14px; cursor: pointer; appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%239097A1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color .12s, box-shadow .12s;
}
.field select:focus, .field .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text); cursor: pointer; }
.chk input { width: auto; accent-color: var(--accent); }
.btn.danger.sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Иерархическое дерево выбора области видимости (Площадка → Контейнер → Аккаунты) */
.scope-tree {
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg);
    padding: 6px 10px; max-height: 460px; overflow-y: auto;
}
.scope-tree details { margin: 1px 0; }
.scope-tree summary {
    cursor: pointer; padding: 5px 4px; user-select: none; list-style: none;
    display: flex; align-items: center; gap: 8px; border-radius: var(--radius-sm);
}
.scope-tree summary::-webkit-details-marker { display: none; }
.scope-tree summary::before {
    content: "▸"; color: var(--muted); font-size: 11px; display: inline-block; transition: transform .12s;
}
.scope-tree details[open] > summary::before { transform: rotate(90deg); }
.scope-tree summary:hover { background: rgba(33, 135, 255, .07); }
.scope-tree .tw { font-weight: 600; }
.scope-tree .cnt-badge { color: var(--muted); font-size: 12px; }
.tree-site > .tree-body { padding-left: 16px; margin-left: 8px; border-left: 1px solid var(--border); }
.tree-cont > .tree-body { padding-left: 16px; margin-left: 8px; border-left: 1px dashed var(--border); }
.tree-accts { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 3px 0 8px; }
.chk.whole { font-weight: 600; color: var(--accent); padding: 4px 0; }

/* Подзаголовок секции и список выбора по аккаунтам пула */
.subhead { font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--text); }
.acct-list .acct { padding: 4px 2px; border-bottom: 1px solid var(--border); }
.acct-list .acct:last-child { border-bottom: none; }
.acct-fp { margin-left: 24px; }
.acct-fp > summary { padding: 2px 4px; font-size: 12px; }
.acct-fp-body { font-size: 13px; padding: 2px 0 5px 6px; }
.acct-fp-body b { font-weight: 600; }

/* Блок управления устройством в попапе (статичные кнопки — плейсхолдеры) */
.manage { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.manage-h { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.manage-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.manage-pool .mng-in {
    flex: 1; min-width: 140px; padding: 7px 10px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 13px;
}
.manage-pool .mng-in:focus { outline: none; border-color: var(--accent); }
.manage-pool .mng-slot { min-width: 74px; font-size: 12px; color: var(--muted); }
.manage-sub { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.manage-note { font-size: 12px; transition: color .2s; }
.manage-note.flash { color: var(--accent); }

/* Ручной серийный номер (задан техником/админом) — выделен акцентным цветом в таблице и попапе. */
.serial-manual { color: var(--accent); font-weight: 600; }
/* Серийник найден в клиенте (журнал учёта клиентов) — зелёная подсветка. Выше специфичность, чем у
   .serial-manual → при ручном И клиентском серийнике побеждает зелёный (привязка к клиенту важнее). */
.col-serial.serial-client, .col-serial.serial-client .serial-val { color: var(--online); font-weight: 600; }
/* Краткая подсветка только что изменённой ячейки серийника (мгновенное подтверждение правки). */
@keyframes serial-edited-flash { from { background: rgba(33, 135, 255, .35); } to { background: transparent; } }
td.col-serial.just-edited { animation: serial-edited-flash 1.4s ease-out; }
/* Редактор серийника в попапе (рабочий, в отличие от плейсхолдеров) — вид как у полей пулов. */
.manage-serial .mng-in {
    flex: 1; min-width: 160px; padding: 7px 10px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 13px;
}
.manage-serial .mng-in:focus { outline: none; border-color: var(--accent); }
.srl-note.ok { color: var(--online); }
.srl-note.err { color: var(--offline); }

/* Инлайн-правка серийника в таблице: значение + квадраты-иконки. Длинный серийник переносится
   (не распирает колонку и не выталкивает таблицу за экран): иконки могут перейти на след. строку. */
.serial-wrap { display: inline-flex; align-items: center; gap: 4px; white-space: normal; flex-wrap: wrap; }
.col-serial .serial-val { word-break: break-all; min-width: 0; }
/* Столбец серийника — шире: длинный серийник помещается в одну строку (overflow-x панели спасёт,
   если совсем длинный); перенос как фолбэк остаётся. */
.col-serial { min-width: 300px; }
.sn-ico { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px;
    padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent;
    color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer; transition: border-color .12s, color .12s;
    flex: 0 0 auto; }
.sn-ico:hover { border-color: var(--accent); color: var(--text); }
.sn-ico:disabled { opacity: .5; cursor: default; }
.sn-apply:hover { border-color: var(--online); color: var(--online); }
.sn-cancel:hover { border-color: var(--offline); color: var(--offline); }
.serial-input { width: 130px; padding: 3px 7px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 12px; }
.serial-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.serial-input.sn-input-err { border-color: var(--offline); }

/* Модалка выгрузки статистики */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center;
    justify-content: center; z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-xl);
    width: 460px; max-width: 92vw; max-height: 88vh; overflow-y: auto; padding: 20px 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head b { font-size: 16px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 6px; }
.modal-foot { display: flex; gap: 10px; margin-top: 18px; }
.modal-card .fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.modal-card .fld label { font-size: 13px; color: var(--muted); }
.modal-card input[type=date] { padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text); font-size: 14px; }
.export-workers { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px; background: var(--bg); margin: 4px 0; }

/* --- Поиск устройства на странице площадки: поле + автодополняющий скролл-дропдаун --- */
.dev-search { position: relative; margin: 4px 0 22px; max-width: 560px; }
.dev-search .dev-q { width: 100%; box-sizing: border-box; padding: 11px 14px; font-size: 14px;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg);
    transition: border-color .12s, box-shadow .12s; }
.dev-search .dev-q:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.dev-search .dev-q::placeholder { color: var(--muted); }
.ds-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
    max-height: 360px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-menu); padding: 4px; }
.ds-item { display: block; text-decoration: none; color: var(--text); padding: 8px 10px; border-radius: var(--radius-md); }
.ds-item:hover, .ds-item.active { background: rgba(33, 135, 255, .12); }
.ds-item .ds-title { display: flex; align-items: baseline; gap: 8px; }
.ds-item .ds-model { font-weight: 600; font-size: 14px; }
.ds-item .ds-ident { color: var(--muted); font-size: 13px; }
.ds-item .ds-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.ds-item .ds-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
/* Пометка архивного устройства в подсказке поиска (margin-left:auto прижимает её и статус вправо). */
.ds-arch { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 8px;
    background: rgba(241, 196, 15, .18); color: #d8b400; white-space: nowrap; }

/* Подсветка устройства, к которому перешли по якорю из поиска. */
.asic-row.row-target > td { background: rgba(33, 135, 255, .20) !important; animation: rowTargetFade 4s ease-out; }
@keyframes rowTargetFade { 0% { background: rgba(33, 135, 255, .42); } 100% { background: rgba(33, 135, 255, .06); } }

/* ════════════════════════════════════════════════════════════════════════
   Схема размещения контейнера (вид сбоку): /containers/{id}/layout (редактор)
   + read-only блок над таблицей на странице контейнера. Спека —
   AsicWatch/design_handoff_container_layout (high-fidelity, цвета «металла»
   захардкожены по дизайну: рамы #4A4F58/#3F434C, гофра, пол). */

body.layout-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.lay-head { padding: 18px 28px 0; flex: 0 0 auto; }
.lay-head .crumbs { margin-bottom: 12px; }
.lay-head .head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.lay-head .head-left { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.lay-head .cnts { margin: 0; }

.lay-legend { display: inline-flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.lay-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.lay-legend .fan-sw { width: 11px; height: 11px; border-radius: 50%; border: 2px solid; }
.lay-legend .fan-sw.on  { border-color: var(--online); }
.lay-legend .fan-sw.wr  { border-color: var(--degraded); }
.lay-legend .fan-sw.off { border-color: var(--offline); }
.lay-legend .fan-sw.po  { border-color: var(--muted); }
.lay-legend .sw.emp { width: 12px; height: 12px; border-radius: 3px; background: rgba(144,151,161,.08); border: 1px dashed var(--border); }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 0 28px 20px; overflow-y: auto; }

/* ─── Корпус контейнера (вид сбоку) ─── */
.van-wrap { flex: 0 0 auto; overflow-x: auto; overflow-y: hidden; }
.van-shell { min-width: 1320px; border: 3px solid #4A4F58; border-radius: 8px; overflow: hidden; background: #16171B; }
.van-top {
  height: 32px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: repeating-linear-gradient(90deg, #26282E 0 10px, #202227 10px 20px);
  border-bottom: 3px solid #4A4F58;
}
.van-top .stencil {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: #6B717C;
  background: rgba(22,23,27,.72); padding: 2px 8px; border-radius: 3px; white-space: nowrap;
}
.van-body { display: flex; align-items: stretch; background: linear-gradient(180deg, #17181C, #131417); }
.van-end {
  width: 26px; flex: 0 0 26px;
  background: repeating-linear-gradient(90deg, #24262B 0 6px, #1E2025 6px 12px);
  border-right: 3px solid #3F434C;
}
.van-door { width: 50px; flex: 0 0 50px; position: relative; background: linear-gradient(90deg, #23252A, #1D1F24 65%); border-left: 3px solid #4A4F58; }
.van-door::before {
  content: ""; position: absolute; top: 10px; bottom: 10px; left: 12px; width: 4px;
  border-radius: 2px; background: #41454E; box-shadow: 17px 0 0 #41454E;
}
.van-door .door-lbl {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(90deg);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: #6B717C; white-space: nowrap;
}
.van-room { flex: 1; min-width: 0; display: flex; gap: 8px; padding: 16px 12px 0; }
.axis-col { width: 20px; flex: 0 0 20px; display: flex; flex-direction: column; padding-top: 3px; }
.axis-col .ax {
  height: calc(var(--slot-h, 22px) + 11px);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
}
.axis-col .ax-foot { height: 22px; }
.rack-col { flex: 1; min-width: 80px; display: flex; flex-direction: column; }
.rack { flex: 0 0 auto; border: 3px solid #3F434C; border-bottom: none; border-radius: 3px 3px 0 0; background: #1B1D21; }
.level { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 4px; border-bottom: 3px solid #3F434C; }
.rack-foot {
  height: 22px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.rack-foot b { color: var(--text); font-weight: 600; }
.van-floor { height: 16px; border-top: 3px solid #4A4F58; background: repeating-linear-gradient(45deg, #26282D 0 10px, #1F2125 10px 20px); }

/* ─── Ячейка ─── */
.slot {
  position: relative; height: var(--slot-h, 22px); min-width: 20px;
  border-radius: 3px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .1s, background .1s, box-shadow .1s;
}
.slot.empty { background: rgba(144,151,161,.07); border: 1px dashed #3A3E46; }
.slot.empty .plus { color: var(--muted); font-size: 13px; line-height: 1; opacity: 0; transition: opacity .1s; }
.slot.empty:hover { border-color: var(--accent); background: var(--row-hover); }
.slot.empty:hover .plus { opacity: 1; color: var(--accent); }
/* read-only вид: пустые места инертны */
.van-readonly .slot.empty { cursor: default; }
.van-readonly .slot.empty:hover { border-color: #3A3E46; background: rgba(144,151,161,.07); }

.slot.filled { background: linear-gradient(180deg, #24262C, #1A1C20); border: 1px solid #3A3E46; cursor: grab; }
.slot.filled:active { cursor: grabbing; }
.slot.filled:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.van-readonly .slot.filled { cursor: pointer; }
.fan {
  height: calc(var(--slot-h, 22px) * .55); aspect-ratio: 1 / 1;
  border-radius: 50%; border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
}
.fan::after { content: ""; width: 22%; height: 22%; border-radius: 50%; background: currentColor; }
.slot.st-ONLINE   .fan { color: var(--online);   box-shadow: 0 0 8px rgba(39,192,106,.30); }
.slot.st-DEGRADED .fan { color: var(--degraded); box-shadow: 0 0 8px rgba(245,166,35,.30); }
.slot.st-OFFLINE  .fan { color: var(--offline);  box-shadow: none; opacity: .85; }
/* «Отключен» (офлайн >24ч): серый круг — оборудование стоит на месте, но обесточено */
.slot.st-POWERED_OFF .fan { color: var(--muted); box-shadow: none; opacity: .85; }

.slot.drag-over { border: 1px solid var(--accent) !important; background: var(--accent-ring) !important; box-shadow: 0 0 0 2px var(--accent-ring); }
.slot.drag-src { opacity: .35; }

.slot-x {
  position: absolute; top: -7px; right: -7px; z-index: 3;
  width: 16px; height: 16px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 9px; line-height: 1; padding: 0; cursor: pointer;
}
.slot.filled:hover .slot-x { display: flex; }
.slot-x:hover { color: var(--offline); border-color: var(--offline); background: var(--offline-bg); }

/* ─── Пул «Нераспределённые ASIC» ─── */
.laypool {
  flex: 1 0 auto; min-height: 132px; max-height: 480px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-xl);
  transition: box-shadow .12s, border-color .12s;
}
.laypool.drop-ok { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.laypool-head { display: flex; align-items: center; gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.laypool-head h3 { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.laypool-head .hint { color: var(--muted); font-size: 12px; flex: 1; min-width: 0; }
.pool-search { position: relative; width: 280px; flex: 0 0 280px; }
.pool-search input {
  width: 100%; padding: 7px 10px 7px 30px; font-family: var(--font-ui); font-size: 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md); outline: none;
}
.pool-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.pool-search .ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.laypool-list {
  flex: 1; overflow: auto; padding: 10px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 8px; align-content: start;
}
.laypool-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 10px; grid-column: 1 / -1; }

.pool-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--panel-2); cursor: grab; user-select: none;
}
.pool-item:active { cursor: grabbing; }
.pool-item:hover { border-color: var(--accent); }
.pool-item.drag-src { opacity: .35; }
.pool-item .grip { color: var(--muted); font-size: 11px; letter-spacing: 1px; flex: 0 0 auto; }
.pool-item .pi-main { flex: 1; min-width: 0; }
.pool-item .pi-serial { font-family: var(--font-mono); font-size: 12px; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-item .pi-model { color: var(--muted); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Воркер — отдельной третьей строкой (читаемость при выборе карточки для дропа) */
.pool-item .pi-worker { color: var(--muted); font-family: var(--font-mono); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.pi-dot.st-ONLINE { background: var(--online); }
.pi-dot.st-DEGRADED { background: var(--degraded); }
.pi-dot.st-OFFLINE { background: var(--offline); }
.pi-dot.st-POWERED_OFF { background: var(--muted); }

/* ─── Тултип занятой ячейки ─── */
.slot-tip {
  position: fixed; z-index: 1200; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-tip); padding: 10px 12px; min-width: 230px;
  font-size: 12px; display: none;
}
.slot-tip .tt-pos { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.slot-tip .tt-serial { font-family: var(--font-mono); font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.slot-tip .tt-model { color: var(--muted); margin-bottom: 8px; }
.slot-tip .tt-rows { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; }
.slot-tip .tt-rows .k { color: var(--muted); }
.slot-tip .tt-rows .v { font-variant-numeric: tabular-nums; text-align: right; }
.slot-tip .tt-rows .v.mono { font-family: var(--font-mono); font-size: 11px; }
.slot-tip .tt-badge { margin-top: 8px; }

/* ─── Пикер «Установить ASIC» ─── */
.pick-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,10,18,.72);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.pick-overlay.open { display: flex; }
.pick-modal {
  width: 480px; max-width: 92vw; max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-brand);
  box-shadow: var(--shadow-menu);
}
.pick-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.pick-head .ph-main { flex: 1; }
.pick-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.pick-head .ph-pos { color: var(--muted); font-size: 13px; }
.pick-close { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.pick-close:hover { color: var(--text); background: var(--panel-2); }
.pick-search { padding: 12px 18px; }
.pick-search input {
  width: 100%; padding: 10px 12px; font-family: var(--font-ui); font-size: 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md); outline: none;
}
.pick-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.pick-list { flex: 1; overflow: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pick-item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-family: var(--font-ui);
}
.pick-item:hover { border-color: var(--accent); background: var(--row-hover); }
.pick-item .pi-serial { font-family: var(--font-mono); font-size: 13px; font-weight: 600; display: block; }
.pick-item .pi-model { color: var(--muted); font-size: 12px; display: block; }
.pick-item .pi-main { flex: 1; min-width: 0; }
.pick-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 10px; }

/* ─── Read-only блок схемы на странице контейнера ─── */
.van-block { margin: 18px 0 22px; }
.van-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.van-block-head h2 { margin: 0; }
.van-block-head .muted-note { color: var(--muted); font-size: 12px; }
.van-block-head .spacer { flex: 1; }

/* ════════════════════════════════════════════════════════════════════════
   Журналы «Проблемные устройства» (техники) и «Сервис» (ТЗ prompt_crm_journals,
   дизайн — MCAsicWatchJournals/ui_kits/journals): kanban-доска, drawer-карточка,
   комментарии, тосты, экран выбора сотрудника. Структура классов — как в
   прототипе (.kb-*, .dw-*, .cmnt-*, .emp-*), значения — токены темы. */

/* ─── Шапка журнала ─── */
.topbar .user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Меню шапки: пункты навигации свёрнуты под кнопку «Меню», список раскрывается по наведению/фокусу.
   Каждый пункт внутри — role-gated (sec:authorize), поэтому видны только доступные по правам имена. */
.navmenu { position: relative; display: inline-block; }
.navmenu-trigger { margin-right: 4px; }
.navmenu-list { display: none; position: absolute; top: 100%; left: 0; z-index: 60;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 6px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow-menu); min-width: 210px; }
.navmenu:hover .navmenu-list, .navmenu:focus-within .navmenu-list { display: flex; }
.navmenu-list .btn { margin-right: 0; white-space: nowrap; text-align: left; }
.jr-link-active { border-color: var(--accent) !important; color: var(--accent); }
.emp-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px;
    border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text); font-size: 13px; }
.emp-chip .av { width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
    color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; }
.emp-chip b { font-weight: 600; }

.jr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; margin-bottom: 16px; }
.jr-head h2 { margin-bottom: 0; }
.jr-tools { display: flex; gap: 12px; align-items: center; }
.jr-view { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.jr-view button { background: transparent; border: none; color: var(--muted); padding: 8px 16px;
    font-size: 13px; font-weight: 600; cursor: pointer; }
.jr-view button.active { background: var(--accent); color: var(--on-accent); }

/* ─── Kanban-доска (§6.1) ─── */
.kb-board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px;
    align-items: start; overflow-x: auto; padding-bottom: 6px; }
@media (max-width: 1100px) { .kb-board { display: flex; } .kb-board .kb-col { min-width: 270px; flex: 0 0 270px; } }

/* Доска журнала (техники/сервис) занимает всю ширину окна — чтобы все воронки помещались
   на широких экранах; на узких включается горизонтальный скролл + краевые стрелки (ниже). */
body[data-journal] .container.wide { max-width: none; }

/* Скроллбары доски и колонок — в цвет тёмной темы: тонкий бегунок var(--border) с отступом
   под фон, прозрачная дорожка; светлее при наведении. */
body[data-journal] .kb-board,
.kb-col-body { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
body[data-journal] .kb-board::-webkit-scrollbar,
.kb-col-body::-webkit-scrollbar { width: 10px; height: 10px; }
body[data-journal] .kb-board::-webkit-scrollbar-track,
.kb-col-body::-webkit-scrollbar-track { background: transparent; }
body[data-journal] .kb-board::-webkit-scrollbar-thumb,
.kb-col-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); border: 2px solid var(--bg); }
body[data-journal] .kb-board::-webkit-scrollbar-thumb:hover,
.kb-col-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Краевой автоскролл доски: полупрозрачные стрелки-кружки у левого/правого края окна.
   Появляются при наведении к краю и только пока есть куда листать (логика — journal.js). */
.kb-edge {
    position: fixed; top: 50%; transform: translateY(-50%); z-index: 60;
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(33, 135, 255, .28); color: var(--on-accent);
    border: 1px solid rgba(255, 255, 255, .18); box-shadow: var(--shadow-tip);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.kb-edge.left { left: 16px; }
.kb-edge.right { right: 16px; }
.kb-edge.show { opacity: 1; }
.kb-edge svg { width: 22px; height: 22px; }
/* Стрелки edge-scroll для скролл-таблиц (edgescroll.js): вид как у канбана, но позиция (top/left) —
   из JS по краям контейнера (translateY не используем — центрируем через вычисленный top). */
.tbl-edge {
    position: fixed; z-index: 60; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin-top: -20px;
    background: rgba(33, 135, 255, .28); color: var(--on-accent);
    border: 1px solid rgba(255, 255, 255, .18); box-shadow: var(--shadow-tip);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.tbl-edge.show { opacity: 1; }
.tbl-edge svg { width: 20px; height: 20px; }
.kb-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
    border-top: 3px solid var(--col, var(--border)); transition: box-shadow .12s, opacity .12s, border-color .12s; }
.kb-col-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; border-bottom: 1px solid var(--border); }
.kb-col-head .t { font-size: 13px; font-weight: 600; }
.kb-col-head .n { color: var(--muted); font-size: 12px; font-weight: 600;
    background: var(--panel-2); border-radius: var(--radius-pill); padding: 1px 8px; }
.kb-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px;
    max-height: calc(100vh - 320px); overflow-y: auto; }
.kb-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 4px; }
.kb-more { margin: 0 10px 10px; padding: 7px 10px; background: transparent; color: var(--accent);
    border: 1px dashed var(--border); border-radius: var(--radius-md); font-size: 12px; cursor: pointer; }
.kb-more:hover { border-color: var(--accent); }
/* подсветка целей DnD: разрешённые/запрещённые колонки (§6.1) */
.kb-col.drop-ok { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.kb-col.drop-no { opacity: .45; }

.kb-card { position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 10px 12px; cursor: pointer; }
.kb-card:hover { border-color: var(--accent); }
.kb-card.drag-src { opacity: .35; }
.kb-card .dev { font-size: 14px; font-weight: 600; padding-right: 20px; }
.kb-card .ident { color: var(--muted); font-family: var(--font-mono); font-size: 11px;
    line-height: 15px; margin: 3px 0 2px; word-break: break-all; }
.kb-card .client { color: var(--muted); font-size: 12px; margin: 2px 0 4px; }
.kb-card .meta { display: flex; gap: 6px; color: var(--muted); font-size: 12px; margin: 3px 0 6px; }
.kb-card .meta .pool { font-family: var(--font-mono); }
.kb-card .prob { font-size: 12px; line-height: 17px; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.kb-card .foot { display: flex; align-items: center; gap: 12px; margin-top: 7px;
    color: var(--muted); font-size: 12px; min-height: 14px; }
.kb-card .foot .ic { display: inline-flex; align-items: center; gap: 4px; }
.kb-card .foot .ic svg { width: 13px; height: 13px; }
.kb-card .foot .stuck { display: inline-flex; align-items: center; gap: 4px; color: var(--degraded);
    font-weight: 600; margin-left: auto; }
.kb-card .foot .stuck svg { width: 13px; height: 13px; }
/* «В статусе» (д/ч/м) на карточке — нейтрально, прижато вправо (залип >7 дн. = .stuck оранжевым) */
.kb-card .foot .instatus { display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
    margin-left: auto; font-variant-numeric: tabular-nums; }
.kb-card .foot .instatus svg { width: 13px; height: 13px; }
/* Номер задачи/заявки — нижний левый угол карточки, тем же нейтральным стилем, что «В статусе»
   справа (первый ребёнок .foot; «В статусе» прижат вправо своим margin-left:auto). */
.kb-card .foot .tasknum { display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
    font-variant-numeric: tabular-nums; }
/* компактное меню переходов «⋮» на карточке (§6.1: смена статуса без DnD) */
.kb-menu-btn { position: absolute; top: 6px; right: 6px; background: none; border: none;
    color: var(--muted); font-size: 15px; line-height: 1; padding: 3px 7px;
    border-radius: var(--radius-sm); cursor: pointer; }
.kb-menu-btn:hover { color: var(--text); background: var(--panel); }
.kb-revert-btn { position: absolute; top: 6px; right: 30px; background: none; border: none;
    color: var(--muted); font-size: 15px; line-height: 1; padding: 3px 7px;
    border-radius: var(--radius-sm); cursor: pointer; }
.kb-revert-btn:hover { color: var(--degraded); background: var(--panel); }
.kb-menu { position: absolute; top: 28px; right: 6px; z-index: 40; min-width: 200px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-menu); padding: 4px; display: flex; flex-direction: column; }
.kb-menu button { background: none; border: none; text-align: left; color: var(--text);
    font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
    font-family: var(--font-ui); }
.kb-menu button:hover { background: var(--panel-2); }

/* бейджи статусов журналов (цвета §6.1 → токены статусов) */
.badge.j-red   { background: var(--offline-bg);  color: var(--offline); }
.badge.j-blue  { background: rgba(33,135,255,.15); color: var(--accent); }
.badge.j-amber { background: var(--degraded-bg); color: var(--degraded); }
.badge.j-green { background: var(--online-bg);   color: var(--online); }
.badge.j-grey  { background: var(--poweredoff-bg); color: var(--muted); }
/* Пилюля типа неисправности (журнал проблемных устройств): нейтрально-фиолетовая, отличается от статусов. */
.badge.j-problem { background: rgba(167,139,250,.16); color: #b9a7f5; }
/* Модалка выбора типов неисправности: список чекбоксов (мультивыбор). */
.pm-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; max-height: 320px; overflow-y: auto; }
.pm-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md);
    cursor: pointer; font-size: 14px; }
.pm-opt:hover { background: var(--panel-2); }
.pm-opt input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ─── Табличный вид (§6.4) ─── */
.jr-table .dev-model { font-weight: 600; display: block; }
.jr-table .cell-prob { max-width: 300px; }
.jr-table .cell-prob .txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-size: 13px; line-height: 18px; }
.jr-table td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.jr-table tbody tr { cursor: pointer; }

/* ─── Drawer детальной карточки (§6.3) ─── */
.drawer-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(5, 10, 18, .6); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 910; width: 480px; max-width: 96vw;
    background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column;
    box-shadow: var(--shadow-menu); }
@media (max-width: 700px) { .drawer { width: 100vw; max-width: 100vw; } }
.dw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.dw-head .dev { font-size: 17px; font-weight: 700; }
.dw-head .mac { color: var(--muted); font-family: var(--font-mono); font-size: 12px; margin: 2px 0 8px; }
.dw-close { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--muted); font-size: 14px; line-height: 1; padding: 5px 9px; cursor: pointer; }
.dw-close:hover { color: var(--text); border-color: var(--accent); }
.dw-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.dw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.dw-cell .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.dw-cell .v { font-size: 13px; font-weight: 600; margin-top: 2px; }
.dw-cell .v.mono { font-family: var(--font-mono); font-weight: 500; }
.dw-sec { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.dw-sec h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dw-sec .prob-full { font-size: 13px; line-height: 19px; white-space: pre-wrap; }
.dw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dw-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.dw-mirror { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 12px 14px; }
.dw-mirror .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dw-mirror .k { color: var(--muted); font-size: 12px; }
.dw-mirror .ro { color: var(--muted); font-size: 11px; margin-top: 10px; }
.dw-mirror .mc { font-size: 12px; color: var(--muted); line-height: 17px; margin-top: 6px; }
.dw-mirror .mc b { color: var(--text); }
.hist .h { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: baseline;
    padding: 5px 0; font-size: 12px; line-height: 17px; }
.hist .h .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.hist .h .mv { color: var(--muted); }
.hist .h .ts { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ─── Под-вкладка «ЗИП»: переключатель На складе/Архив, таблица, списания ─── */
.zip-views { display: inline-flex; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 4px; margin: 0 0 16px; background: var(--panel); }
.zip-views button { background: transparent; border: none; color: var(--muted); padding: 7px 16px;
    border-radius: var(--radius-sm); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px; transition: background .12s, color .12s; }
.zip-views button:hover { color: var(--text); }
.zip-views button.active { background: var(--accent); color: var(--on-accent); }
.zip-views .cnt { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill);
    background: var(--panel-2); color: var(--muted); }
.zip-views button.active .cnt { background: rgba(255, 255, 255, .25); color: var(--on-accent); }
.zip-table tbody tr:hover { background: var(--row-hover); }
/* Ссылка «задача N» в логах доноров/ЗИП → переход к карточке в «Проблемных устройствах» */
.task-link { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); }
.task-link:hover { text-decoration: none; opacity: .85; }
/* Карточка донора в архиве — приглушённая */
.dn-card.archived { opacity: .72; }
.zip-table th.num, .zip-table td.num { text-align: right; }
.zip-table .dev-model { font-weight: 600; display: block; }
.zip-table .cell-sub { color: var(--muted); font-size: 12px; }
.zip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.wo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wo-list { display: flex; flex-direction: column; gap: 8px; }
.wo-item { display: flex; gap: 10px; align-items: baseline; background: var(--panel-2);
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 11px; }
.wo-item .wo-q { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--offline); }
.wo-item .wo-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px; font-size: 12px; }
.wo-item .wo-c { color: var(--text); }
.wo-item .wo-by { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ─── Комментарии (§4) ─── */
.cmnts { display: flex; flex-direction: column; gap: 10px; }
.cmnt { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 9px 12px; }
.cmnt-head { display: flex; align-items: baseline; gap: 7px; font-size: 12px; flex-wrap: wrap; }
.cmnt-head .who { font-weight: 600; }
.cmnt-head .st { color: var(--muted); }
.cmnt-head .ts { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.cmnt-text { font-size: 13px; line-height: 18px; margin-top: 5px; white-space: pre-wrap; }
.cmnt-edited { color: var(--muted); font-size: 11px; margin-top: 4px; }
.cmnt-form textarea { width: 100%; min-height: 64px; padding: 9px 11px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text);
    font-size: 13px; font-family: var(--font-ui); resize: vertical; }
.cmnt-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.cmnt-form .row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cmnt-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cmnt-count.over { color: var(--offline); font-weight: 600; }
.cmnt-form .row .sp { flex: 1; }

/* ─── Модалки журнала (общая .modal/.modal-card) ─── */
.modal-sub { color: var(--muted); font-size: 13px; line-height: 18px; margin: -6px 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.jr-dev-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto;
    margin-top: 8px; }
.jr-dev-item { display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel-2);
    color: var(--text); cursor: pointer; font-family: var(--font-ui); }
.jr-dev-item:hover { border-color: var(--accent); }
.jr-dev-item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.jr-dev-item[disabled] { opacity: .5; cursor: not-allowed; }
.jr-dev-item .m { font-weight: 600; font-size: 13px; display: block; }
.jr-dev-item .s { color: var(--muted); font-size: 12px; font-family: var(--font-mono); display: block; }
.jr-mac-err { color: var(--offline); font-size: 12px; margin-top: 6px; }

/* ─── Панель управления справочником сервисных центров (§3.2) ─── */
.sc-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto;
    margin: 4px 0 16px; }
.sc-empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }
.sc-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel-2); }
.sc-info { flex: 1; min-width: 0; }
.sc-name { font-weight: 600; font-size: 13px; }
.sc-loc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-used { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-act { display: flex; gap: 6px; }
.sc-del:hover { border-color: var(--offline); color: var(--offline); }
.sc-editing { flex-direction: column; align-items: stretch; }
.sc-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sc-edit input { flex: 1; min-width: 140px; padding: 8px 10px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text);
    font-family: var(--font-ui); font-size: 13px; }
.sc-edit input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.sc-edit-act { display: flex; gap: 6px; }
.sc-add { display: grid; grid-template-columns: 2fr 2fr auto; gap: 12px; align-items: end;
    padding-top: 14px; border-top: 1px solid var(--border); }
.sc-add .field { margin-bottom: 0; }

/* ─── Тосты (§6.5) ─── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1300; display: flex;
    flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--online);
    border-radius: var(--radius-md); box-shadow: var(--shadow-tip); padding: 10px 14px;
    font-size: 13px; line-height: 18px; animation: toast-in .18s ease-out; }
.toast.err { border-left-color: var(--offline); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Экран выбора сотрудника (§5.2) ─── */
.shift-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.shift-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-brand);
    padding: 32px; width: 420px; max-width: 94vw; }
.shift-box .logo { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.shift-box .logo span { color: var(--accent); }
.shift-box .shift-h { font-family: var(--font-display); font-size: 18px; font-weight: 700; text-align: center; margin: 10px 0 2px; }
.shift-box .tag { text-align: center; color: var(--muted); font-size: 13px; line-height: 18px; margin-bottom: 22px; }
.emp-list { display: flex; flex-direction: column; gap: 8px; }
.emp { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text); cursor: pointer; font-family: var(--font-ui); }
.emp:hover { border-color: var(--accent); }
.emp.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.emp.off { opacity: .5; cursor: not-allowed; }
.emp .av { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: 0 0 auto; }
.emp .nm { font-size: 14px; font-weight: 600; display: block; }
.emp .rl { color: var(--muted); font-size: 12px; display: block; }
.emp-pass { padding: 10px 4px 14px; }
.shift-logout { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ─── Журнал учёта клиентов (clients.html / clients.js) ─── */
.cl-table .num { text-align: right; }
.cl-row { cursor: pointer; }
.cl-row:hover { background: var(--row-hover); }
.cl-row.open { background: var(--row-hover); }
.cl-caret { display: inline-block; width: 14px; color: var(--muted); }
.cl-name { display: flex; align-items: center; gap: 10px; }
.cl-name .ava { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2);
    border: 1px solid var(--border); color: var(--text); display: inline-flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.cl-name .nm { font-weight: 600; }
.cl-name .sub { color: var(--muted); font-size: 12px; }
.cl-table .actions { display: flex; align-items: center; gap: 6px; }
.unit { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 2px; }

/* Бар загрузки мощности */
.cap-cell { min-width: 200px; }
.cap-top { font-size: 13px; }
.cap-top .fact { font-weight: 600; }
.cap-top .of { color: var(--muted); font-weight: 400; }
.cap-bar { height: 6px; border-radius: var(--radius-pill); background: var(--panel-2); overflow: hidden; margin: 5px 0 3px; }
.cap-fill { height: 100%; background: var(--online); border-radius: var(--radius-pill); transition: width .2s; }
.cap-fill.high { background: var(--degraded); }
.cap-fill.over { background: var(--offline); }
.cap-pct { font-size: 11px; color: var(--muted); }
.cap-pct.over { color: var(--offline); }

/* Разворот строки: под-таблица договоров */
.cl-detail > td { background: var(--bg); padding: 0; }
.cl-detail-inner { padding: 14px 16px 18px; }
.cl-detail-inner h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.contracts-sub { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius-md); overflow: hidden; }
.contracts-sub th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase;
    letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.contracts-sub th.num, .contracts-sub td.num { text-align: right; }
.contracts-sub td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.contracts-sub tr:last-child td { border-bottom: none; }
.docno { font-family: var(--font-mono); font-size: 12px; }
.loss.warn { color: var(--degraded); font-weight: 600; }
.dev-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; font-size: 12px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-pill); white-space: nowrap; }

.dev-chip .x { color: var(--muted); }
.dev-chip b { font-weight: 700; }
.sn-tag { margin-left: 4px; padding: 1px 7px; border-radius: var(--radius-pill); background: rgba(33,135,255,.15);
    color: var(--accent); font-size: 11px; }
.sn-tag.muted { background: var(--panel); color: var(--muted); }

/* Модалка добавления/правки клиента */
.cl-modal-card { width: 760px; max-width: 96vw; max-height: 88vh; overflow-y: auto; }
.cl-sub-label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 10px; }
.contract-edit { display: flex; flex-direction: column; gap: 14px; }
.contract-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--bg); }
.contract-hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.contract-card-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* Попап «Тариф и потери по месяцам» договора (годовой) + уведомление «не задан» в расчёте. */
.cl-tf-card { width: 560px; max-width: 96vw; max-height: 88vh; overflow-y: auto; }
.um-years { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.tf-grid { display: flex; flex-direction: column; gap: 6px; }
.tf-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; align-items: center; }
.tf-row.tf-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.tf-row .tf-mo { font-size: 13px; }
.tf-row input { width: 100%; padding: 7px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text); font-size: 13px; }
.tag-unset { display: inline-block; font-size: 11px; color: var(--degraded); background: rgba(245, 166, 35, 0.14);
    border-radius: 999px; padding: 1px 8px; }
.contract-card-head .field { flex: 1 1 120px; margin: 0; }
.dev-edit { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.dev-edit-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.dev-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-bottom: 10px; }
.dev-edit-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.dev-edit-row .field { flex: 1 1 100px; margin: 0; }
.dev-sn { margin-top: 10px; }
.dev-sn-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.serial-area { width: 100%; min-height: 64px; resize: vertical; padding: 8px 10px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text);
    font-family: var(--font-mono); font-size: 12px; }
.serial-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.contract-card .rm, .dev-card .rm { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--muted); cursor: pointer; width: 30px; height: 30px; flex: 0 0 auto; }
.contract-card .rm:hover:not([disabled]), .dev-card .rm:hover:not([disabled]) { color: var(--offline); border-color: var(--offline); }
.contract-card .rm[disabled], .dev-card .rm[disabled] { opacity: .4; cursor: not-allowed; }
.add-contract, .dev-add { margin-top: 12px; padding: 8px 12px; background: transparent; color: var(--accent);
    border: 1px dashed var(--border); border-radius: var(--radius-md); font-size: 13px; cursor: pointer; }
.add-contract:hover, .dev-add:hover { border-color: var(--accent); }

/* ─── Воркеры клиента (панель «Нераспределённые» + окно управления) ─── */
.cl-unassigned { margin-top: 22px; }
.cl-uw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.cl-uw-head h3 { margin: 0; }
.wk-count { text-align: right; white-space: nowrap; }
.wk-count b { font-size: 22px; font-weight: 700; }
.wk-count .lbl { display: block; color: var(--muted); font-size: 12px; }
.wk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.wk-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius-md); }
.wk-main { flex: 1 1 auto; min-width: 0; }
.wk-title { display: flex; align-items: center; gap: 8px; }
.wk-title .name { font-family: var(--font-mono); font-weight: 600; }
.wk-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.wk-power { font-weight: 600; white-space: nowrap; }
.wk-power .u { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 2px; }
.wk-rm, .wk-add { width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 15px; }
.wk-add:hover { border-color: var(--online); color: var(--online); }
.wk-rm:hover { border-color: var(--offline); color: var(--offline); }
.wk-assign { max-width: 230px; }
.wk-empty { color: var(--muted); padding: 14px; text-align: center; background: var(--bg);
    border: 1px dashed var(--border); border-radius: var(--radius-md); }
.wk-section-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.wk-section-h h4 { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.wk-section-h .c { color: var(--muted); font-size: 12px; }
.assign-summary { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px; margin-bottom: 6px; }
.assign-summary .row { display: flex; justify-content: space-between; font-size: 13px; }
.assign-summary .k { color: var(--muted); }
.assign-summary .v.over { color: var(--offline); }
.cl-dw-card { width: 640px; max-width: 96vw; max-height: 88vh; display: flex; flex-direction: column; }
.cl-dw-body { overflow-y: auto; padding: 4px 2px; }

/* Выпадающие списки воркеров (фильтр площадки + «Привязать клиента») — единый стиль с .field select:
   тёмная тема, своя SVG-стрелка (appearance:none), тёмный нативный список (color-scheme). */
.wk-assign,
.cl-unassigned .filterbar select,
.cl-dw-card .filterbar select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none; color-scheme: dark;
    padding: 8px 34px 8px 12px; background-color: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%239097A1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color .12s, box-shadow .12s;
}
.wk-assign:focus,
.cl-unassigned .filterbar select:focus,
.cl-dw-card .filterbar select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.wk-assign option,
.cl-unassigned .filterbar select option,
.cl-dw-card .filterbar select option { background: var(--panel); color: var(--text); }

/* Фильтр воркеров (окно «Доступные аккаунты» + панель «Нераспределённые») — в один ряд:
   поиск тянется (и ужимается), селект площадки фикс, счётчик «показано» справа. */
.cl-unassigned .filterbar,
.cl-dw-card .filterbar { flex-wrap: nowrap; align-items: center; }
.cl-unassigned .filterbar .fld,
.cl-dw-card .filterbar .fld { flex: 1 1 auto; min-width: 0; }
.cl-unassigned .filterbar .fld input,
.cl-dw-card .filterbar .fld input { width: 100%; min-width: 0; box-sizing: border-box; }
.cl-unassigned .filterbar select,
.cl-dw-card .filterbar select { flex: 0 0 auto; }
.cl-unassigned .filterbar .muted { flex: 0 0 auto; margin-left: auto; white-space: nowrap; }

/* Тематические скроллбары модалок клиента (окно воркеров + модалка правки) — как в досках журнала. */
.cl-dw-body, .cl-modal-card { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.cl-dw-body::-webkit-scrollbar, .cl-modal-card::-webkit-scrollbar { width: 10px; height: 10px; }
.cl-dw-body::-webkit-scrollbar-track, .cl-modal-card::-webkit-scrollbar-track { background: transparent; }
.cl-dw-body::-webkit-scrollbar-thumb, .cl-modal-card::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: var(--radius-pill); border: 2px solid var(--panel); }
.cl-dw-body::-webkit-scrollbar-thumb:hover, .cl-modal-card::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Помесячные авансовые расчёты (вкладка) ─── */
.cl-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.cl-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted);
    padding: 10px 14px; font: inherit; font-size: 14px; cursor: pointer; margin-bottom: -1px; }
.cl-tab:hover { color: var(--text); }
.cl-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.calc-month { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.calc-month .fld { min-width: 200px; }
.calc-month select { width: 100%; appearance: none; -webkit-appearance: none; color-scheme: dark;
    padding: 9px 34px 9px 12px; background-color: var(--bg); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-md); font-size: 14px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%239097A1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
.calc-month select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.calc-month select option { background: var(--panel); color: var(--text); }
.calc-cell .main { font-weight: 600; }
.calc-cell .sub { color: var(--muted); font-size: 11px; }
.calc-tbl .calc-krow > td { background: var(--bg); }
.calc-tbl .lvl-pad { padding-left: 26px; }
.calc-tbl tfoot td { border-top: 2px solid var(--border); font-weight: 600; }
.calc-tbl tfoot .lbl { color: var(--muted); font-weight: 400; }
.delta.pos { color: var(--online); font-weight: 600; }
.delta.neg { color: var(--offline); font-weight: 600; }
.hours-cell { display: flex; flex-direction: column; gap: 2px; }
.hours-cell .cl-hours { width: 88px; padding: 6px 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 13px; text-align: right; }
.hours-cell .cl-hours:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.hours-cell .hours-view { display: inline-flex; align-items: center; gap: 6px; }
.hours-cell .hours-view[hidden] { display: none; }
.hours-cell .hours-val { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
/* Ручной ввод плановых часов (override) — синяя подсветка; авторасчёт по графику — обычный цвет. */
.hours-cell .hours-val.manual { color: var(--accent); font-weight: 700; }
.hours-cell .cl-hours.manual { border-color: var(--accent); color: var(--accent); }
.hours-cell .sub { color: var(--muted); font-size: 11px; }
/* Кликабельный IP → веб-интерфейс устройства (ADMIN/TECHNICIAN). */
a.dev-weblink { color: var(--accent); text-decoration: none; cursor: pointer; }
a.dev-weblink:hover { text-decoration: underline; }
.mon-panel { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; overflow: hidden; }
.mon-head { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel); border: none;
    color: var(--text); padding: 12px 14px; cursor: pointer; font: inherit; font-size: 14px; text-align: left; }
.mon-head:hover { background: var(--row-hover); }
.mon-title { font-weight: 600; }
.mon-counts { display: flex; gap: 14px; margin-left: auto; font-size: 13px; }
.mon-counts .ok { color: var(--online); }
.mon-counts .bad { color: var(--degraded); }
.mon-body { max-height: 320px; overflow-y: auto; border-top: 1px solid var(--border);
    scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.mon-body::-webkit-scrollbar { width: 10px; }
.mon-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); border: 2px solid var(--panel); }
.mon-tbl .mono { font-family: var(--font-mono); font-size: 12px; }

/* ─── Журнал «Местоположение оборудования» ─── */
.loc-tbl-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.loc-table .mono { font-family: var(--font-mono); font-size: 12.5px; }
.loc-table .muted { color: var(--muted); }
.loc-table tbody tr.loc-row { cursor: pointer; }
.loc-table tbody tr.loc-row:hover { background: var(--row-hover); }
.loc-cell { display: flex; align-items: center; gap: 10px; }
.loc-ico { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center;
    justify-content: center; border-radius: var(--radius-sm); }
.loc-ico svg { width: 15px; height: 15px; }
.loc-ico.site { color: var(--online); background: var(--online-bg); }
.loc-ico.transit { color: var(--accent); background: rgba(33, 135, 255, .14); }
.loc-ico.service { color: var(--degraded); background: var(--degraded-bg); }
.loc-main { display: flex; flex-direction: column; min-width: 0; }
.loc-name { font-weight: 600; font-size: 13.5px; }
.loc-sub { color: var(--muted); font-size: 12px; }
.loc-cell .badge { margin-left: 4px; }
.src { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill);
    text-transform: lowercase; letter-spacing: .02em; }
.src.mon { color: var(--online); background: var(--online-bg); }
.src.transit { color: var(--accent); background: rgba(33, 135, 255, .14); }
.src.svc { color: var(--degraded); background: var(--degraded-bg); }
.hist-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-pill);
    color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; transition: border-color .12s, color .12s; }
.hist-btn:hover { border-color: var(--accent); color: var(--accent); }
.hist-arrow { color: var(--muted); font-size: 11px; }
.hist-btn:hover .hist-arrow { color: var(--accent); }

/* Таймлайн перемещений в попапе истории */
.mv-timeline { list-style: none; margin: 14px 0 4px; padding: 0; position: relative; max-height: 56vh; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.mv-timeline::-webkit-scrollbar { width: 9px; }
.mv-timeline::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); border: 2px solid var(--panel); }
.mv-item { position: relative; padding: 0 4px 18px 22px; border-left: 2px solid var(--border); }
.mv-item:last-child { border-left-color: transparent; padding-bottom: 2px; }
.mv-dot { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--panel); border: 2px solid var(--muted); }
.mv-item.site .mv-dot { border-color: var(--online); }
.mv-item.transit .mv-dot { border-color: var(--accent); }
.mv-item.service .mv-dot { border-color: var(--degraded); }
.mv-item.current .mv-dot { box-shadow: 0 0 0 4px var(--accent-ring); }
.mv-top { display: flex; align-items: center; gap: 10px; }
.mv-event { font-weight: 600; font-size: 14px; }
.mv-now { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-ring);
    padding: 1px 8px; border-radius: var(--radius-pill); }
.mv-loc { display: flex; align-items: center; gap: 8px; margin: 5px 0 3px; flex-wrap: wrap; }
.mv-tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--radius-pill); }
.mv-tag.site { color: var(--online); background: var(--online-bg); }
.mv-tag.transit { color: var(--accent); background: rgba(33, 135, 255, .14); }
.mv-tag.service { color: var(--degraded); background: var(--degraded-bg); }
.mv-detail { color: var(--muted); font-size: 13px; }
.mv-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.mv-sep { opacity: .5; }

/* Диалог выгрузки */
.exp-daterow { display: flex; align-items: flex-end; gap: 12px; margin: 4px 0 2px; }
.exp-dash { color: var(--muted); padding-bottom: 9px; }

/* ─── Под-вкладка «Доноры» журнала техников ─── */
.jr-subtabs { display: inline-flex; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 4px; margin: 4px 0 16px; background: var(--panel); }
.jr-subtabs button { background: transparent; border: none; color: var(--muted); padding: 7px 16px;
    border-radius: var(--radius-sm); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .12s, color .12s; }
.jr-subtabs button:hover { color: var(--text); }
.jr-subtabs button.active { background: var(--accent); color: var(--on-accent); }

/* Реестр доноров — сетка карточек */
.dn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 4px; }
.dn-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel);
    padding: 14px 16px; cursor: pointer; transition: border-color .12s, transform .08s; }
.dn-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.dn-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dn-card .dev { font-weight: 600; font-size: 14px; }
.dn-card .sn { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-top: 2px; }
.dn-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; margin: 9px 0 11px; }
.dn-meta .src { padding: 0; background: none; color: var(--muted); text-transform: none; font-weight: 400; letter-spacing: 0; }
.dn-bar { height: 7px; border-radius: var(--radius-pill); background: var(--panel-2);
    border: 1px solid var(--border); overflow: hidden; }
.dn-bar i { display: block; height: 100%; background: var(--online); transition: width .2s; }
.dn-bar.empty i { background: var(--muted); }
.dn-pcount { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px;
    font-size: 12px; }
.dn-pcount .a { font-weight: 600; }
.dn-pcount .m { color: var(--muted); }

/* Список запчастей (drawer донора + предпросмотр) */
.parts-list { display: flex; flex-direction: column; gap: 7px; }
.part-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 9px 11px; background: var(--panel-2); }
.part-row.used { opacity: .82; }
.part-row .pmain { min-width: 0; }
.part-row .pt { font-weight: 600; font-size: 13px; }
.part-row .ps { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-top: 1px; }
.part-dest { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 17px; }
.part-dest b { color: var(--text); }
.part-row .pstat { flex: none; }

/* Снятие донора / прочие действия */
.dn-archive { color: var(--offline); }
.dn-archive:hover { border-color: var(--offline); }

/* Модалка добавления донора */
.src-tabs { display: inline-flex; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 4px; margin: 4px 0 14px; }
.src-tabs button { background: transparent; border: none; color: var(--muted); padding: 7px 16px;
    border-radius: var(--radius-sm); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.src-tabs button.active { background: var(--accent); color: var(--on-accent); }
.mon-list { max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
    margin: 4px 0 2px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.mon-list::-webkit-scrollbar { width: 9px; }
.mon-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); border: 2px solid var(--panel); }
.mon-row { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel-2);
    color: var(--text); padding: 9px 11px; font: inherit; transition: border-color .12s; }
.mon-row:hover { border-color: var(--accent); }
.mon-row.sel { border-color: var(--accent); background: var(--accent-ring); }
.mon-row .m1 { font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.mon-row .smono { color: var(--muted); font-weight: 400; font-size: 12px; font-family: var(--font-mono); }
.mon-row .m3 { color: var(--muted); font-size: 12px; }
.mon-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 4px; }

/* Редактируемый список узлов в модалке добавления */
.dn-parts-head { margin: 16px 0 4px; font-size: 13px; }
.partsel { display: flex; flex-direction: column; gap: 7px; }
.partsel-row { display: flex; align-items: center; gap: 8px; }
.partsel-row .pfields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; min-width: 0; }
.partsel-row input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    color: var(--text); padding: 8px 10px; font-family: var(--font-ui); font-size: 13px; }
.partsel-row .prem { flex: none; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 13px; }
.partsel-row .prem:hover { border-color: var(--offline); color: var(--offline); }

/* «Исправлено с донором»: выбор донора и узлов */
.donor-box { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; margin: 12px 0 4px;
    background: var(--panel-2); }
.donor-box .lead { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.donor-perm { margin-top: 12px; font-size: 12px; color: var(--degraded); }
.part-pick { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 9px 11px; cursor: pointer; background: var(--panel); transition: border-color .12s; }
.part-pick:hover { border-color: var(--accent); }
.part-pick.sel { border-color: var(--accent); background: var(--accent-ring); }
.part-pick input { flex: none; }
.part-pick .pt { font-weight: 600; font-size: 13px; }
.part-pick .ps { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-left: 8px; }

/* ============ Площадка: обзорный дашборд + сетка плиток контейнеров (дизайн-кит «site») ============ */
:root { --stencil: var(--font-mono); }

.page-head { margin: 6px 0 18px; }
.page-head .head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head h2 { margin: 2px 0 0; }

/* отметка времени последнего авто-обновления (UTC+3 / МСК) */
.refresh-stamp { align-self: center; font-size: 12px; color: var(--muted); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px; }
.head-aside { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ctop { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ctop h1 { margin: 0; }
.refresh-stamp::before { content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--online, #3ad29f); box-shadow: 0 0 0 0 rgba(58, 210, 159, .5);
    animation: refresh-pulse 2s ease-out infinite; }
@keyframes refresh-pulse { 0% { box-shadow: 0 0 0 0 rgba(58, 210, 159, .45); }
    70% { box-shadow: 0 0 0 5px rgba(58, 210, 159, 0); } 100% { box-shadow: 0 0 0 0 rgba(58, 210, 159, 0); } }
/* нет связи с сервером — гасим «живой» пульс и краснеем, чтобы не выдавать протухшие данные за свежие */
.refresh-stamp.stale { color: var(--offline, #e5484d); }
.refresh-stamp.stale::before { animation: none; background: var(--offline, #e5484d); box-shadow: none; }

/* ── обзор: три карточки ── */
.overview { display: flex; flex-direction: column; gap: 16px; margin: 10px 0 4px; }
.ov-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
.ov-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ov-title { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ov-note { color: var(--muted); font-size: 13px; }
.ov-note b { color: var(--text); }

.seg-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.seg-toggle button { border: none; background: transparent; color: var(--muted); padding: 5px 12px; font-size: 13px; cursor: pointer; }
.seg-toggle button.active { background: var(--accent); color: #fff; }

.series-row { display: flex; align-items: baseline; }
.series-row.scrypt { margin-top: 12px; }
.hero-val { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hero-val .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-val .big2 { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-val .u { color: var(--muted); font-size: 13px; }
.hero-val .algo-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 6px; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up-good { color: var(--online); }
.delta.down-bad { color: var(--offline); }

/* графики (SVG растягивается; покраска ниже по #id — var() не резолвится в presentation-атрибутах) */
.chart-wrap { position: relative; margin-top: 8px; }
.chart { width: 100%; height: 120px; display: block; }
.chart.small { height: 46px; }
.spark { width: 100%; height: 72px; display: block; }
.chart-hit { position: absolute; inset: 0; cursor: crosshair; }
.chart-cursor, .chart-dot, .chart-tip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s; }
.chart-wrap.show .chart-cursor, .chart-wrap.show .chart-dot, .chart-wrap.show .chart-tip { opacity: 1; }
.chart-cursor { top: 0; bottom: 0; width: 1px; background: var(--border); }
.chart-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); transform: translate(-50%, -50%); }
.chart-tip { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 8px;
  font-size: 12px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); z-index: 5; }
.chart-tip .tip-d { color: var(--muted); font-size: 11px; }
.chart-tip .tip-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .tip-v .u { color: var(--muted); font-weight: 400; margin-left: 3px; }

#sha-line { stroke: var(--accent); fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
#sha-area { fill: url(#grad-sha); stroke: none; }
#scr-line { stroke: var(--muted); fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
#attn-line { stroke: var(--degraded); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#attn-area { fill: url(#grad-attn); stroke: none; }
#attn-dots circle { fill: var(--degraded); stroke: var(--panel); stroke-width: 1.5; }
#grad-sha .s0 { stop-color: var(--accent); stop-opacity: .26; }
#grad-sha .s1 { stop-color: var(--accent); stop-opacity: 0; }
#grad-attn .s0 { stop-color: var(--degraded); stop-opacity: .26; }
#grad-attn .s1 { stop-color: var(--degraded); stop-opacity: 0; }

/* здоровье парка: донат + легенда */
.health-body { display: flex; align-items: center; gap: 18px; }
.donut { position: relative; width: 120px; height: 120px; flex: 0 0 auto; }
.donut svg { width: 120px; height: 120px; }
.donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .pct { font-size: 22px; font-weight: 700; }
.donut .cl { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 12px; }
.lg-group { display: flex; flex-direction: column; gap: 6px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lg .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.lg .nm { color: var(--muted); }
.lg .ct { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
#donut-svg path { fill: none; stroke-width: 13; }
#donut-svg .seg-on { stroke: var(--online); }
#donut-svg .seg-warn { stroke: var(--degraded); }
#donut-svg .seg-off { stroke: var(--offline); }

/* требуют внимания */
.attn-body { display: flex; align-items: center; gap: 18px; }
.attn-fig .big { font-size: 30px; font-weight: 700; color: var(--degraded); font-variant-numeric: tabular-nums; }
.attn-body .chart-wrap { flex: 1; margin-top: 0; }
/* Разбивка под общим числом «внимания» (проблемные / офлайн раздельно) — мелкий приглушённый текст. */
.attn-breakdown { margin-top: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.attn-breakdown #attn-prob-ct { color: var(--degraded); font-weight: 600; }
.attn-breakdown #attn-off-ct { color: var(--offline); font-weight: 600; }

/* ── тулбар (поиск + табы) ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 20px 0 10px; }
.toolbar .dev-search { margin: 0; flex: 1; min-width: 280px; max-width: 560px; }
.toolbar .dev-search .ds-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.toolbar .dev-search .dev-q { padding-left: 36px; }
.toolbar .tabs { margin: 0; }
.tab-count { margin-left: 6px; color: var(--muted); }
.tab-btn.active .tab-count { color: var(--accent); }

/* ── сетка плиток контейнеров ── */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.ctile { position: relative; display: flex; flex-direction: column; gap: 9px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px 12px 18px; text-decoration: none; color: var(--text); overflow: hidden;
  transition: border-color .12s, transform .12s; }
.ctile:hover { border-color: var(--accent); transform: translateY(-1px); }
.ctile .edge { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.ctile[data-status="ok"] .edge { background: var(--online); }
.ctile[data-status="warn"] .edge { background: var(--degraded); }
.ctile[data-status="off"] .edge { background: var(--offline); }
.ctile[data-status="empty"] .edge { background: var(--border); }
.ctile[data-status="empty"] { opacity: .72; }
.ctile .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ctile .num { font-family: var(--stencil); font-weight: 700; font-size: 18px; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; flex: 0 0 auto; }
.pill.ok { background: var(--online-bg); color: var(--online); }
.pill.warn { background: var(--degraded-bg); color: var(--degraded); }
.pill.off { background: var(--offline-bg); color: var(--offline); }
.pill.empty { background: var(--panel-2); color: var(--muted); }
.ctile .asic { font-size: 13px; color: var(--muted); }
.ctile .asic .tot { color: var(--text); font-weight: 600; }
.ctile .asic .warn { color: var(--degraded); }
.ctile .asic .bad { color: var(--offline); }
.ctile .asic.empty-note { font-style: italic; }
.ctile .health { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel-2); }
.ctile .health .seg { display: block; }
.ctile .health .seg.g { background: var(--online); }
.ctile .health .seg.a { background: var(--degraded); }
.ctile .health .seg.r { background: var(--offline); }
.ctile .hr { display: flex; flex-direction: column; gap: 2px; }
.ctile .hr-main { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; }
.ctile .hr-sub { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: baseline; gap: 6px; }
.ctile .hr .u { font-size: 11px; color: var(--muted); font-weight: 400; }
.ctile .hr .alg { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-left: auto; }
.ctile .hr-none { color: var(--muted); font-size: 18px; }
.ctile .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.ctile .ago { font-size: 12px; color: var(--muted); }
.ctile .chev { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }

@media (max-width: 880px) { .ov-top { grid-template-columns: 1fr; } }

/* ============ Флот (страница «Площадки»): карта региона + рейл + карточки площадок (дизайн-кит «sites») ============ */
.geo { margin-bottom: 16px; }
.geo-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 15px 18px; }
/* Шапка карты с кнопкой свернуть/развернуть. У свёрнутой карты убираем нижний отступ шапки и скрываем
   сетку (карта в DOM не строится — см. sites-overview.js buildMap()). */
.geo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.geo-card.collapsed .geo-head { margin-bottom: 0; }
.geo-card.collapsed .geo-grid { display: none; }
.geo-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: center; }
@media (max-width: 980px) { .geo-grid { grid-template-columns: 1fr; } }

/* ── карта (генерируемый inline SVG) ── */
.map-wrap { position: relative; min-width: 0; }
#map-svg { width: 100%; height: auto; display: block; overflow: hidden; border-radius: var(--radius-md); }
#map-land { fill: var(--panel-2); stroke: var(--border); stroke-width: 1.2; stroke-linejoin: round; }
#relief-rect { mix-blend-mode: soft-light; opacity: .55; }
#stipple-rect { opacity: .9; }
#stipple .stip { fill: var(--border); }
#graticule path { fill: none; stroke: var(--border); stroke-width: .6; opacity: .32; }
#map-coast { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; opacity: .35; }
#map-bay { fill: none; }
.water { fill: var(--bg); stroke: #3a4a57; stroke-width: 1; stroke-linejoin: round; }
.river { fill: none; stroke: #3a4a57; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.road { fill: none; stroke: var(--muted); stroke-width: 1.4; opacity: .4; }
.place-dot { fill: var(--muted); stroke: var(--bg); stroke-width: 1; }
.place-label { font-family: var(--font-ui); font-size: 11.5px; fill: var(--muted); paint-order: stroke; stroke: var(--panel-2); stroke-width: 3px; stroke-linejoin: round; }
.place-city .place-dot { fill: var(--text); }
.place-city .place-label { fill: var(--text); font-weight: 600; font-size: 12.5px; }
.map-inset { position: absolute; top: 12px; right: 12px; width: 154px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 7px 7px; box-shadow: var(--shadow-menu); }
.map-inset .mi-cap { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
#inset-svg { display: block; width: 100%; height: auto; }
#inset-land { fill: var(--panel-2); stroke: var(--border); stroke-width: 1; stroke-linejoin: round; }
#inset-rect { fill: var(--accent); fill-opacity: .14; stroke: var(--accent); stroke-width: 1.5; }
.inset-dot { stroke: var(--bg); stroke-width: .8; }
.inset-dot.mk-online { fill: var(--online); }
.inset-dot.mk-degraded { fill: var(--degraded); }
.inset-dot.mk-offline { fill: var(--offline); }
.mk { cursor: pointer; }
.mk-glow { fill: currentColor; opacity: .16; transition: opacity .12s; }
.mk-dot { fill: currentColor; stroke: var(--bg); stroke-width: 2.5; transition: stroke .12s; }
.mk-online { color: var(--online); }
.mk-degraded { color: var(--degraded); }
.mk-offline { color: var(--offline); }
.mk-label { font-family: var(--font-ui); font-size: 15px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--panel-2); stroke-width: 4px; stroke-linejoin: round; }
.mk.hot .mk-glow { opacity: .32; }
.mk.hot .mk-dot { stroke: var(--text); }
.mk-pulse { fill: none; stroke: currentColor; stroke-width: 1.5; opacity: 0; }
.map-sea { font-family: var(--font-ui); font-size: 13px; font-weight: 600; fill: var(--muted); opacity: .42; letter-spacing: .16em; text-transform: uppercase; }
.map-geo { font-family: var(--font-ui); font-size: 12px; font-weight: 500; fill: var(--muted); opacity: .7; }
@media (prefers-reduced-motion: no-preference) {
  .mk-degraded .mk-pulse, .mk-offline .mk-pulse { animation: mkpulse 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
}
@keyframes mkpulse { 0% { opacity: .55; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.4); } }

/* ── рейл триажа площадок ── */
.geo-side { display: flex; flex-direction: column; min-width: 0; }
.geo-side .ov-head { margin-bottom: 10px; }
#site-rail { display: flex; flex-direction: column; gap: 2px; }
.rail-row { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: none; border-radius: var(--radius-md); padding: 8px 10px; cursor: pointer; font-family: var(--font-ui); color: var(--text); transition: background .12s; }
.rail-row:hover, .rail-row.hot { background: var(--row-hover); }
.rl-dot { width: 9px; height: 9px; border-radius: 2px; }
.rl-dot.ONLINE { background: var(--online); }
.rl-dot.DEGRADED { background: var(--degraded); }
.rl-dot.OFFLINE { background: var(--offline); }
.rl-name { font-size: 14px; font-weight: 600; min-width: 0; display: flex; flex-direction: column; }
.rl-city { font-size: 11px; font-weight: 400; color: var(--muted); }
.rl-att { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 22px; text-align: right; }
.rl-att.warn { color: var(--degraded); }
.rl-att.bad { color: var(--offline); }
.rl-hr { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }
.rl-hr .u { font-size: 10px; margin-left: 2px; }
.rail-note { font-size: 11px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.rail-note .swatch { width: 18px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--muted), var(--text)); display: inline-block; flex: 0 0 auto; }

/* ── тулбар: поиск + сортировка ── */
.toolbar .sort-wrap { display: flex; align-items: center; gap: 9px; }
.sort-wrap .lbl { font-size: 12px; color: var(--muted); }

/* ── карточки площадок ── */
.scards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.scard { position: relative; display: flex; flex-direction: column; gap: 11px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 15px 16px 13px 20px; overflow: hidden; color: var(--text); text-decoration: none; transition: border-color .12s, background .12s, box-shadow .12s; }
.scard:hover { border-color: var(--accent); background: var(--row-hover); }
.scard .edge { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.scard[data-status="ONLINE"] .edge { background: var(--online); }
.scard[data-status="DEGRADED"] .edge { background: var(--degraded); }
.scard[data-status="OFFLINE"] .edge { background: var(--offline); }
.scard.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.scard .sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.scard .sc-title { font-family: var(--font-display); font-size: 18px; line-height: 1.1; font-weight: 700; }
.scard .sc-sub { color: var(--muted); font-size: 12px; margin-top: 3px; font-family: var(--font-mono); }
.scard .sc-meta { font-size: 13px; color: var(--muted); }
.scard .sc-meta .hp { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.scard .asic { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scard .asic .tot { color: var(--text); font-weight: 600; }
.scard .asic .warn { color: var(--degraded); font-weight: 600; }
.scard .asic .bad { color: var(--offline); font-weight: 600; }
.scard .health { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel-2); }
.scard .health .seg { height: 100%; }
.scard .seg.g { background: var(--online); }
.scard .seg.a { background: var(--degraded); }
.scard .seg.r { background: var(--offline); }
.scard .hr { display: flex; flex-direction: column; gap: 2px; }
.scard .hr-main { font-size: 21px; line-height: 1.1; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.scard .hr-main .u { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.scard .hr-main .alg { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .03em; margin-left: 6px; }
.scard .hr-sub { font-size: 14px; line-height: 1.1; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.scard .hr-sub .u { font-size: 10px; margin-left: 2px; }
.scard .hr-sub .alg { font-family: var(--font-mono); font-size: 11px; margin-left: 6px; }
.scard .foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scard .ago { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.scard .ago.stale-crit { color: var(--offline); font-weight: 600; }
.scard .ago .wico { width: 12px; height: 12px; flex: 0 0 auto; }
.scard .chev { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; transition: color .12s, transform .12s; }
.scard:hover .chev { color: var(--accent); transform: translateX(2px); }

/* график «Требуют внимания» флота: проблемы (amber) + офлайн (red) наложены, общая шкала */
#attn-prob-line { stroke: var(--degraded); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#attn-off-line { stroke: var(--offline); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
#attn-prob-area { fill: url(#grad-prob); stroke: none; }
#attn-off-area { fill: url(#grad-off); stroke: none; }
#grad-prob .s0 { stop-color: var(--degraded); stop-opacity: .26; }
#grad-prob .s1 { stop-color: var(--degraded); stop-opacity: 0; }
#grad-off .s0 { stop-color: var(--offline); stop-opacity: .24; }
#grad-off .s1 { stop-color: var(--offline); stop-opacity: 0; }
.attn-legend { display: flex; gap: 12px; }
.attn-legend .al { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.attn-legend .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
/* точки hover для двух наложенных рядов attn: проблемы (amber) / офлайн (red) */
.chart-dot.dot-prob { background: var(--degraded); }
.chart-dot.dot-off { background: var(--offline); }

/* ============================================================================
   Режим аптайма (журнал клиентов): модалки графика отключений / календаря праздников.
   Порт дизайн-кита MCAsicWatchCal (uptime.css): почасовая сетка 24×12, годовой календарь.
   ============================================================================ */
.modal-sub { margin: -6px 0 16px; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ─── modal sizing (база — .modal-card) ─── */
.um-card { width: 1060px; }

/* ─── bars (режим / год) ─── */
.um-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px; margin-bottom: 14px;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.um-bar-lbl { font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
    color: var(--muted); margin-right: 2px; }
.um-bar .field { margin: 0; min-width: 240px; }
.um-bar .grow { flex: 1; }
.um-name-input { min-width: 240px; padding: 9px 12px; font: 600 14px var(--font-ui);
    background: var(--panel); color: var(--text);
    border: 1px solid var(--accent); border-radius: var(--radius-md);
    outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.um-icobtn { display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex: 0 0 auto; cursor: pointer;
    background: transparent; color: var(--muted);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; transition: color .12s, border-color .12s, background .12s; }
.um-icobtn:hover { color: var(--text); border-color: var(--accent); }
.um-icobtn.danger:hover { color: var(--offline); border-color: var(--offline); }
.um-yearchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    font: 600 13px var(--font-mono); cursor: pointer; white-space: nowrap;
    background: transparent; color: var(--muted);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    transition: color .12s, border-color .12s, background .12s; }
.um-yearchip:hover { color: var(--text); border-color: var(--accent); }
.um-yearchip.active { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.um-yearchip .ro { font: 400 10px var(--font-ui); opacity: .8; }
.um-readonly-note { font-size: 12px; color: var(--degraded); }
.um-cal-link { font: 600 12px var(--font-ui); cursor: pointer; white-space: nowrap;
    background: transparent; color: var(--accent);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 5px 10px; transition: border-color .12s, background .12s; }
.um-cal-link:hover { border-color: var(--accent); background: var(--accent-ring); }
.um-holi-ref { display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-top: 12px; padding: 11px 13px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 12px; color: var(--muted); line-height: 1.45; }
.um-holi-ref .um-cal-link { flex: 0 0 auto; }

/* ─── section wrap ─── */
.um-sec { margin: 18px 0; }
.um-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.um-sec-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.um-sec-head .meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.um-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-left: auto; }
.um-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.um-legend i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.um-legend i.on { background: var(--accent-ring); border-color: rgba(33,135,255,.5); }
.um-legend i.off { background: var(--bg); }
.um-legend i.wknd { background: var(--panel-2); }
.um-legend i.holi { background: var(--accent-ring); border-color: rgba(33,135,255,.5); }
.um-legend i.peak { background: rgba(252,152,64,.22); border-color: rgba(252,152,64,.65); }

/* ─── hour grid 24×12 ─── */
.hg { display: grid; grid-template-columns: 92px repeat(24, minmax(0, 1fr));
    gap: 3px; user-select: none;
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; background: var(--panel); }
.hg-corner { font-size: 10px; color: var(--muted); display: flex; align-items: flex-end; padding-bottom: 4px; }
.hg-hd { font: 600 10px var(--font-mono); color: var(--muted); cursor: pointer;
    border-radius: var(--radius-sm); font-variant-numeric: tabular-nums; height: 44px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hg-hd span { transform: rotate(-90deg); white-space: nowrap; line-height: 1; }
.hg-hd:hover { color: var(--text); background: var(--row-hover); }
.hg-rowlbl { font: 600 12px var(--font-ui); color: var(--text); display: flex; align-items: center;
    padding-right: 8px; cursor: pointer; border-radius: var(--radius-sm); }
.hg-rowlbl:hover { color: var(--accent); }
.hg-rowlbl .roff { margin-left: auto; font: 400 10px var(--font-mono); color: var(--muted); }
.hg-cell { height: 24px; border-radius: 3px; cursor: pointer;
    border: 1px solid transparent; transition: background .08s, border-color .08s;
    display: flex; align-items: center; justify-content: center; }
.hg-cell.on { background: var(--accent-ring); border-color: rgba(33,135,255,.35); }
.hg-cell.off { background: var(--bg); }
.hg-cell.off::after { content: "·"; color: var(--muted); font-size: 13px; line-height: 1; }
.hg-cell.on:hover { border-color: var(--accent); }
.hg-cell.off:hover { border-color: var(--border); background: var(--panel-2); }
.hg.ro .hg-cell, .hg.ro .hg-hd, .hg.ro .hg-rowlbl { cursor: default; }
.hg.ro .hg-cell:hover { border-color: transparent; }

/* ─── year calendar (12 months) ─── */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cal-month { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 11px; }
.cal-month-h { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 3px; }
.cal-dow span { font: 600 9px var(--font-ui); color: var(--muted); text-align: center; text-transform: uppercase; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { aspect-ratio: 1; min-height: 18px; display: flex; align-items: center; justify-content: center;
    font: 500 11px var(--font-mono); color: var(--text); font-variant-numeric: tabular-nums;
    border: 1px solid transparent; border-radius: 3px; cursor: pointer;
    transition: background .1s, border-color .1s, color .1s; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.out { visibility: hidden; }
.cal-day.wknd { background: var(--panel-2); color: var(--muted); cursor: default; }
.cal-day.wknd:hover { border-color: transparent; }
.cal-day.holi { background: var(--accent-ring); color: var(--accent); border-color: rgba(33,135,255,.4); font-weight: 700; }
.cal-day.peak { background: rgba(252,152,64,.2); color: var(--chart-temp, #FC9840); border-color: rgba(252,152,64,.55); font-weight: 700; }
.cal-day.peak:hover { border-color: #FC9840; }
.cal-grid.peak .cal-day.wknd, .cal-grid.peak .cal-day.holi { cursor: default; }
.cal-grid.peak .cal-day.wknd:hover, .cal-grid.peak .cal-day.holi:hover { border-color: transparent; }
.cal-grid.ro .cal-day { cursor: default; }
.cal-grid.ro .cal-day:hover { border-color: transparent; }

/* ─── выбор будних дней отключения ─── */
.um-peak-check { display: flex; align-items: center; gap: 9px; margin-top: 14px;
    font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.um-peak-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }
.um-peak-hint { font-size: 12px; color: var(--muted); }
.um-peak-cal { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.um-peak-bulk { display: inline-flex; gap: 8px; }

/* ─── режим аптайма в карточке договора ─── */
.contract-mode { margin: 12px 0 0; }
.contract-mode label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
