/* === EWO MODULE STYLES — Цех «База внеплановых ремонтов» === */
/* Переиспользует общие variable'ы из styles.css.
   Палитра — оранжево-янтарная (отличается от Mixing-blue и Packing-indigo). */

:root {
  --ewo-text-strong: #f1f5f9;
  --ewo-text-primary: #e2e8f0;
  --ewo-text-secondary: #a8a29e;
  --ewo-text-muted: #b9b0a4;          /* contrast >= 4.5:1 на тёмном — WCAG AA */
  --ewo-accent: #f97316;              /* orange-500 */
  --ewo-accent-light: #fb923c;        /* orange-400 */
  --ewo-accent-dark: #ea580c;         /* orange-600 */
  --ewo-accent-glow: rgba(249, 115, 22, 0.25);
  --ewo-bg-soft: rgba(249, 115, 22, 0.06);
  --ewo-bg-soft2: rgba(249, 115, 22, 0.12);
  --ewo-border-soft: rgba(249, 115, 22, 0.3);
  --ewo-border-soft2: rgba(249, 115, 22, 0.55);
  --ewo-status-open: #f59e0b;         /* amber-500 — Открыто */
  --ewo-status-progress: #3b82f6;     /* blue-500 — В работе */
  --ewo-status-done: #10b981;         /* green-500 — Выполнено */
  --ewo-status-rejected: #6b7280;     /* gray-500 — Отклонено */
  /* Surface-палитра (13.05.2026) — wrapping раньше hardcoded stone-цветов в variable'ы,
     чтобы PC-режим мог per-scope переключиться на GitHub-dark (slate) через #ewo-app:not(.ewo-mode-tablet)
     override. По умолчанию stone (для tablet и pre-login mode/subworkshop selectors).
     ВНИМАНИЕ: значения здесь ОБЯЗАНЫ быть hex-литералами, не var()-self-references —
     replace_all hex→var в прошлой сессии случайно сделал cycle (--ewo-surface-0: var(--ewo-surface-0))
     → CSS invalid → resolved to transparent → tablet терял рамки и фоны модалов. Fix 13.05.2026. */
  --ewo-surface-0: #1c1917;           /* main bg / inputs / dark cards */
  --ewo-surface-1: #292524;           /* sidebar / panels */
  --ewo-surface-2: #3a3633;           /* hover state на task cards */
  --ewo-border-1: #44403c;            /* borders */
}

/* === Workshop selector — общая 3-колоночная сетка === */
/* Override 2-col grid из packing.css; 3 плитки в одной строке если место есть.
   На узких viewport — auto-fit. */
#workshop-selector .workshop-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#ws-ewo {
  border-color: var(--ewo-border-soft);
  background: linear-gradient(135deg, var(--ewo-bg-soft2), var(--ewo-bg-soft));
}
#ws-ewo:hover {
  border-color: var(--ewo-border-soft2);
  background: linear-gradient(135deg, rgba(249,115,22,0.18), rgba(249,115,22,0.06));
  box-shadow: 0 8px 32px var(--ewo-accent-glow);
}
#ws-ewo .workshop-icon { color: var(--ewo-accent-light); }

/* === EWO mode-selector (Планшет/ПК) === */
#ewo-mode-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--ewo-surface-0) 0%, var(--ewo-surface-1) 50%, var(--ewo-surface-0) 100%);
}

/* Mode-selector login-container шире чем стандартный 380 — чтобы заголовок не ломался */
#ewo-mode-selector .login-container,
#ewo-subworkshop-selector .login-container {
  max-width: 520px;
  width: calc(100% - 32px);
}

/* Большая «тревожная» иконка над заголовком — h1 остаётся коротким и не переносится */
.ewo-header-icon {
  font-size: 56px;
  line-height: 1;
  text-align: center;
  margin-bottom: 8px;
}
#ewo-mode-selector .login-header h1,
#ewo-subworkshop-selector .login-header h1 {
  white-space: normal;
  word-break: keep-all;
  font-size: 26px;
}

.ewo-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

.ewo-mode-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 44px 28px;
  border: 2px solid var(--ewo-border-soft);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ewo-bg-soft2), var(--ewo-bg-soft));
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  color: var(--ewo-text-primary);
  min-width: 220px;
}
.ewo-mode-tile:hover {
  border-color: var(--ewo-border-soft2);
  transform: translateY(-4px);
  box-shadow: 0 10px 36px var(--ewo-accent-glow);
}
.ewo-mode-tile-icon { font-size: 56px; line-height: 1; }
.ewo-mode-tile-name { font-size: 19px; font-weight: 700; color: var(--ewo-text-strong); }
.ewo-mode-tile-desc { font-size: 13px; color: var(--ewo-text-secondary); text-align: center; }

/* ===== Mobile (≤640px): min-width:220px распирал грид (2×220+24 > контейнера) —
   плитка «ПК» уезжала за правый край экрана телефона. Снимаем флор + дорожки
   minmax(0,1fr); overflow-wrap страхует desc внутри узкой плитки (≤360px). ===== */
@media (max-width: 640px) {
  .ewo-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ewo-mode-tile { min-width: 0; }
  .ewo-mode-tile-desc { overflow-wrap: anywhere; }
}
/* Сверхузкие телефоны: 2 колонки дают ~50px на текст (рубит слова) → в столбик. */
@media (max-width: 360px) {
  .ewo-mode-grid { grid-template-columns: 1fr; }
}

#ewo-mode-back, #ewo-sub-back {
  display: block;
  margin: 18px auto 0;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ewo-text-secondary);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
#ewo-mode-back:hover, #ewo-sub-back:hover {
  border-color: var(--ewo-border-soft2);
  color: var(--ewo-text-strong);
}

/* === EWO sub-workshop selector (только в tablet после login) === */
#ewo-subworkshop-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--ewo-surface-0) 0%, var(--ewo-surface-1) 50%, var(--ewo-surface-0) 100%);
}
#ewo-subworkshop-selector .workshop-grid {
  grid-template-columns: 1fr 1fr;
}

/* === EWO App Layout === */
#ewo-app {
  display: flex;
  min-height: 100vh;
  background: var(--ewo-surface-0);
  color: var(--ewo-text-primary);
}

/* PC-only фон — GitHub-dark палитра (точная синхронизация с Packing PC через
   общие variable'ы из styles.css: --bg-primary #0d1117, --bg-secondary #161b22,
   --border-color #30363d). Это почти-чёрный с минимальным blue-tint, не slate-blue.
   Tablet (.ewo-mode-tablet) остаётся со stone-тёмным для preserving tablet identity:
   там оранжевые акценты + warm surfaces — отдельная brand identity. (13.05.2026)

   Перевод происходит через переопределение 4 surface variables в одном месте —
   CSS cascade подхватывает их во всех правилах ниже (inputs, panels, cards, modals,
   borders, sidebar, hover-state и т.д.) без точечных overrides. */
#ewo-app:not(.ewo-mode-tablet) {
  --ewo-surface-0: var(--bg-primary, #0d1117);
  --ewo-surface-1: var(--bg-secondary, #161b22);
  --ewo-surface-2: var(--bg-tertiary, #21262d);
  --ewo-border-1: var(--border-color, #30363d);
}

.ewo-sidebar {
  width: 240px;
  background: var(--ewo-surface-1);
  border-right: 1px solid var(--ewo-border-1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.ewo-sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--ewo-border-1);
}
.ewo-sidebar-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  margin: 0 0 8px 0;
}
.ewo-sidebar-header .ewo-mode-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent-light);
  font-weight: 600;
  margin-right: 4px;
}
.ewo-sidebar-header .sidebar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ewo-text-secondary);
  cursor: pointer;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: none;
  transition: all 0.2s;
  font-family: inherit;
}
.ewo-sidebar-header .sidebar-back:hover {
  border-color: var(--ewo-border-soft2);
  color: var(--ewo-text-strong);
}

.ewo-nav-menu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

.ewo-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ewo-text-primary);
  transition: background 0.2s;
  user-select: none;
}
.ewo-nav-item:hover { background: rgba(255,255,255,0.04); }
.ewo-nav-item:focus-visible {
  outline: 2px solid var(--ewo-accent);
  outline-offset: -2px;
}
.ewo-nav-item.active {
  background: var(--ewo-bg-soft2);
  color: var(--ewo-text-strong);
  border-left: 3px solid var(--ewo-accent);
  padding-left: 17px;
}
.ewo-nav-icon { font-size: 18px; line-height: 1; }
.ewo-nav-text { font-weight: 500; }

.ewo-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--ewo-border-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hotfix 09.05.2026 (UX): user-card на 2-row grid вместо 1-row flex.
   Раньше avatar+info+sse-status были в одной flex-строке: SSE-индикатор
   с текстом «Подключено» забирал ~120px справа, info оставалось ~50px,
   и имя «Завъялов А.» обрезалось до «Завъ...». Теперь avatar охватывает
   2 строки слева, name+role на полной ширине row 1, SSE-status на row 2
   (тоже на полной ширине). HTML не меняется — selector `.ewo-user-card .sse-status`
   адресует существующий `<div id="ewo-sse-status" class="sse-status">`. */
.ewo-user-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 6px;
}
.ewo-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  grid-row: 1 / span 2;
}
.ewo-user-info { display: flex; flex-direction: column; min-width: 0; }
.ewo-user-name {
  font-size: 13px; font-weight: 600;
  color: var(--ewo-text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ewo-user-role {
  font-size: 11px; color: var(--ewo-text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ewo-user-card .sse-status {
  grid-column: 2;
  grid-row: 2;
  margin-top: 2px;
}

.ewo-sidebar-btn {
  font-size: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--ewo-text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.ewo-sidebar-btn:hover {
  border-color: var(--ewo-border-soft2);
  color: var(--ewo-text-strong);
}

.ewo-main {
  margin-left: 240px;
  flex: 1;
  padding: 24px 28px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ewo-breadcrumb {
  font-size: 13px;
  color: var(--ewo-text-muted);
  margin-bottom: 16px;
  min-height: 18px;
}

.ewo-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ewo-empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 14px;
  color: var(--ewo-text-muted);
  text-align: center;
}

/* === Dashboard tiles === */
.ewo-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  padding: 8px 0;
}

.ewo-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 22px;
  border: 1px solid var(--ewo-border-soft);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(249,115,22,0.06), rgba(249,115,22,0.02));
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  font-family: inherit;
  text-align: left;
  color: var(--ewo-text-primary);
  min-height: 130px;
}
.ewo-tile:hover {
  border-color: var(--ewo-border-soft2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--ewo-accent-glow);
}
.ewo-tile:focus-visible {
  outline: 2px solid var(--ewo-accent);
  outline-offset: 2px;
}
.ewo-tile-icon { font-size: 36px; line-height: 1; }
.ewo-tile-title { font-size: 18px; font-weight: 700; color: var(--ewo-text-strong); }
.ewo-tile-subtitle { font-size: 13px; color: var(--ewo-text-secondary); }
.ewo-tile-badge {
  position: absolute;
  top: 14px; right: 14px;
  min-width: 28px; height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  background: var(--ewo-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ewo-tile-create { border-color: rgba(16,185,129,0.4); background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(16,185,129,0.02)); }
.ewo-tile-create:hover { border-color: rgba(16,185,129,0.7); box-shadow: 0 8px 24px rgba(16,185,129,0.25); }
.ewo-tile-open { border-color: rgba(245,158,11,0.4); background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.02)); }
.ewo-tile-progress { border-color: rgba(59,130,246,0.4); background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02)); }
.ewo-tile-archive { border-color: rgba(107,114,128,0.4); background: linear-gradient(135deg, rgba(107,114,128,0.08), rgba(107,114,128,0.02)); }

/* === Tablet: плитки крупнее, в одну колонку на узких экранах === */
#ewo-app.ewo-mode-tablet .ewo-tiles-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
#ewo-app.ewo-mode-tablet .ewo-tile { min-height: 160px; padding: 28px 24px; }
#ewo-app.ewo-mode-tablet .ewo-tile-icon { font-size: 44px; }
#ewo-app.ewo-mode-tablet .ewo-tile-title { font-size: 20px; }

/* === Tablet: post-accept интер-экран ===
   Показывается после успешного приёма EWO в работу. Две большие плитки:
   «🔧 Заполнить ремонт» (primary, акцентная) и «🏠 Вернуться в главное меню».
   Layout — flex по центру, плитки растягиваются на всю ширину content'а
   (для узких/планшетных экранов перекомпонуются в 1 столбец автоматически). */
.ewo-post-accept-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ewo-text-secondary);
}
.ewo-post-accept-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.ewo-post-accept-tiles {
  display: grid;
  /* auto-fit: 2 плитки (working без pause / paused) или 3 (working + ⏸ Приостановить)
     укладываются в ряд на широком экране, переносятся на узком. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  width: 100%;
  max-width: 1100px;
}
.ewo-post-accept-tile {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 240px;
  padding: 36px 28px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ewo-text-primary);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ewo-post-accept-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.ewo-post-accept-tile:focus-visible {
  outline: none;
  border-color: var(--ewo-accent);
  box-shadow: 0 0 0 4px var(--ewo-accent-glow);
}
.ewo-post-accept-tile:active { transform: translateY(0); }

.ewo-post-accept-primary {
  border-color: var(--ewo-accent);
  background: linear-gradient(135deg, rgba(249,115,22,0.18) 0%, rgba(249,115,22,0.06) 100%);
  box-shadow: 0 6px 22px rgba(249,115,22,0.18);
}
.ewo-post-accept-primary:hover {
  border-color: var(--ewo-accent-light);
  background: linear-gradient(135deg, rgba(249,115,22,0.26) 0%, rgba(249,115,22,0.10) 100%);
  box-shadow: 0 8px 28px rgba(249,115,22,0.28);
}

/* Пауза/возобновление (30.05): янтарный акцент плитки «⏸ Приостановить работу». */
.ewo-post-accept-pause {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(135deg, rgba(245,158,11,0.14) 0%, rgba(245,158,11,0.04) 100%);
}
.ewo-post-accept-pause:hover {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245,158,11,0.22) 0%, rgba(245,158,11,0.08) 100%);
}
.ewo-post-accept-pause .ewo-post-accept-title { color: #fbbf24; }

.ewo-post-accept-icon {
  font-size: 64px;
  line-height: 1;
}
.ewo-post-accept-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  letter-spacing: 0.01em;
}
.ewo-post-accept-primary .ewo-post-accept-title { color: var(--ewo-accent-light); }
.ewo-post-accept-hint {
  font-size: 14px;
  color: var(--ewo-text-secondary);
  line-height: 1.4;
  max-width: 320px;
}
@media (max-width: 820px) {
  .ewo-post-accept-tiles { grid-template-columns: 1fr; gap: 16px; }
  .ewo-post-accept-tile { min-height: 180px; padding: 28px 20px; }
  .ewo-post-accept-icon { font-size: 48px; }
  .ewo-post-accept-title { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .ewo-post-accept-tile { transition: none; }
  .ewo-post-accept-tile:hover { transform: none; }
}

/* === Forms === */
.ewo-form { max-width: 720px; }
/* Phase 7D/E/F: PC create-EWO форма full-width с 3-колоночным layout.
   align-items: stretch → все три карточки одинаковой высоты, без «прыжков». */
.ewo-form.ewo-form-wide { max-width: none; width: 100%; }
.ewo-create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}
.ewo-create-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ewo-create-col-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ewo-accent-light);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}
/* Уплотнение полей внутри карточек: form-row отступ 14→10, textarea min-height 60→50. */
.ewo-create-col .ewo-form-row,
.ewo-create-col .ewo-form-row-2col { margin-bottom: 10px; }
.ewo-create-col .ewo-textarea { min-height: 50px; }
.ewo-create-col fieldset.ewo-5w-group { margin-top: 6px; }
/* Последний form-row внутри карточки — без bottom-margin (избегаем пустоты внизу). */
.ewo-create-col > .ewo-form-row:last-child,
.ewo-create-col > fieldset:last-child,
.ewo-create-col > .ewo-form-row-2col:last-child { margin-bottom: 0; }

@media (max-width: 1300px) {
  .ewo-create-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ewo-create-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* Header create-EWO формы — упорядоченный flex (back+title слева, badge справа). */
.ewo-create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.ewo-create-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ewo-create-header-title {
  margin: 0;
  color: var(--ewo-text-strong);
  font-size: 22px;
  font-weight: 700;
}
.ewo-create-header-badge {
  color: var(--ewo-text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

/* Phase 7E/F: 5W+1H — full-width блок под grid'ом.
   CSS multi-column layout (вместо grid) — автоматически балансирует высоту
   колонок: fieldset'ы перетекают в следующую колонку без «дыр». Из 6 fieldset
   (WHAT 5q / WHERE 4q / WHEN 3q / WHO 4q / WHICH 4q / HOW 2q) браузер сам
   распределяет их в 3 колонки сравнимой высоты. */
.ewo-form-wide .ewo-5w1h { margin-top: 18px; }
.ewo-form-wide .ewo-5w1h[open] > summary { margin-bottom: 14px; }

/* Акцентированный summary 5W+1H в PC create-form: яркая CTA-плитка с
   градиентным border'ом и pulse-анимацией, чтобы пользователь увидел
   что блок свёрнут и его рекомендуется заполнить. */
.ewo-5w1h.ewo-5w1h-cta {
  border: 1.5px solid var(--ewo-accent);
  background: linear-gradient(135deg, rgba(249,115,22,0.10) 0%, rgba(249,115,22,0.04) 100%);
  box-shadow: 0 0 0 1px rgba(249,115,22,0.15), 0 4px 14px rgba(249,115,22,0.10);
  animation: ewo5w1hCtaPulse 2.4s ease-in-out infinite;
}
.ewo-5w1h.ewo-5w1h-cta[open] {
  animation: none;
  box-shadow: none;
  background: rgba(255,255,255,0.02);
  border-color: var(--ewo-border-1);
}
.ewo-5w1h.ewo-5w1h-cta > summary {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
.ewo-5w1h.ewo-5w1h-cta > summary::before {
  content: '▶';
  color: var(--ewo-accent);
  margin-right: 0;
  font-size: 12px;
  flex: 0 0 auto;
}
.ewo-5w1h-cta-icon {
  font-size: 26px;
  line-height: 1;
  flex: 0 0 auto;
}
.ewo-5w1h-cta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}
.ewo-5w1h-cta-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  letter-spacing: 0.01em;
}
.ewo-5w1h-cta-hint {
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  font-weight: 500;
}
.ewo-5w1h-cta-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--ewo-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
@keyframes ewo5w1hCtaPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(249,115,22,0.15), 0 4px 14px rgba(249,115,22,0.10); }
  50%      { box-shadow: 0 0 0 1px rgba(249,115,22,0.35), 0 6px 22px rgba(249,115,22,0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .ewo-5w1h.ewo-5w1h-cta { animation: none; }
}
@media (max-width: 700px) {
  .ewo-5w1h.ewo-5w1h-cta > summary { flex-wrap: wrap; }
  .ewo-5w1h-cta-badge { order: 3; margin-left: auto; }
}

.ewo-form-wide .ewo-5w1h-body {
  /* Отменяем display:flex от базового .ewo-5w1h-body — multicolumn
     не работает поверх flex-контейнера. */
  display: block;
  column-count: 3;
  column-gap: 18px;
}
.ewo-form-wide .ewo-5w1h-body .ewo-5w-group {
  margin: 0 0 16px;
  padding: 12px 14px;
  break-inside: avoid;
  /* break-inside для старых браузеров */
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
}
@media (max-width: 1300px) {
  .ewo-form-wide .ewo-5w1h-body { column-count: 2; }
}
@media (max-width: 900px) {
  .ewo-form-wide .ewo-5w1h-body { column-count: 1; }
}
/* Fix-2 (28.05.2026): Часть A — 8 вопросов в 5 fieldsets — 2 колонки оптимально
   (column-count: 3 default делает узкие столбцы и пустоты). */
.ewo-form-wide .ewo-5w1h-body-part-a { column-count: 2; }
@media (max-width: 900px) {
  .ewo-form-wide .ewo-5w1h-body-part-a { column-count: 1; }
}
/* Внутри 5W+1H секций plitki Да/Нет/— фиксированной ширины. */
.ewo-form-wide .ewo-5w1h-body .ewo-wizard-q-row {
  padding: 10px 12px;
  gap: 8px;
}
.ewo-form-wide .ewo-5w1h-body .ewo-wizard-q-text {
  font-size: 13.5px;
  line-height: 1.35;
}
.ewo-form-wide .ewo-5w1h-body .ewo-wizard-q-options { gap: 6px; }
.ewo-form-wide .ewo-5w1h-body .ewo-wizard-q-options label {
  /* Кнопки Да/Нет/— и enum-options растягиваются равномерно по ширине
     fieldset'а (multicolumn даёт ~1/3 ширины формы, кнопки занимают её целиком). */
  flex: 1 1 0;
  min-width: 70px;
  max-width: none;
  padding: 10px 12px;
  font-size: 14px;
}
.ewo-form-row { margin-bottom: 14px; }
.ewo-form-row label,
.ewo-form-row-2col label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ewo-text-secondary);
  margin-bottom: 6px;
}
.ewo-form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ewo-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--ewo-surface-0);
  color: var(--ewo-text-primary);
  border: 1px solid var(--ewo-border-1);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ewo-input:focus {
  border-color: var(--ewo-accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--ewo-accent-glow);
}
.ewo-input[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.ewo-textarea {
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  /* Phase 7C: длинные строки без пробелов (например "fffffff...") должны переноситься,
     иначе вылезают за рамки контейнера в tablet/wizard. */
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.ewo-input {
  /* Phase 7C: те же правила переноса для одностроковых input — длинные tokens. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Phase 7C: read-only текст в детальном просмотре (описание, причина и т.п.) тоже
   должен переносить длинные не-пробельные строки. */
.ewo-detail-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ewo-detail-five-whys li {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ewo-cms-auto-cause,
.ewo-cms-auto-action {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ewo-rep-temp-label,
.ewo-rep-start-value,
.ewo-rep-start-label {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ewo-ana-tile,
.ewo-wiz-tile {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ewo-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}
.ewo-btn-primary,
.ewo-btn-secondary,
.ewo-btn-back {
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.ewo-btn-primary {
  background: var(--ewo-accent);
  color: #fff;
  border-color: var(--ewo-accent);
  font-weight: 600;
}
.ewo-btn-primary:hover { background: var(--ewo-accent-dark); border-color: var(--ewo-accent-dark); }
.ewo-btn-primary:disabled { opacity: 0.6; cursor: wait; }
.ewo-btn-success {
  background: #10b981 !important;
  border-color: #10b981 !important;
}
.ewo-btn-success:hover { background: #059669 !important; border-color: #059669 !important; }
.ewo-btn-reject {
  border-color: rgba(239,68,68,0.5) !important;
  color: #fca5a5 !important;
}
.ewo-btn-reject:hover { border-color: rgba(239,68,68,0.8) !important; background: rgba(239,68,68,0.08) !important; }
.ewo-btn-secondary {
  background: transparent;
  color: var(--ewo-text-secondary);
  border-color: rgba(255,255,255,0.15);
}
.ewo-btn-secondary:hover {
  border-color: var(--ewo-border-soft2);
  color: var(--ewo-text-strong);
}
.ewo-btn-back {
  background: transparent;
  color: var(--ewo-text-secondary);
  border-color: rgba(255,255,255,0.12);
  font-size: 13px;
  padding: 6px 12px;
}
.ewo-btn-back:hover { border-color: var(--ewo-border-soft2); color: var(--ewo-text-strong); }

.ewo-form-error {
  padding: 10px 14px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: 6px;
  margin: 12px 0;
}

/* === Tablet: форма крупнее === */
#ewo-app.ewo-mode-tablet .ewo-input { padding: 14px 14px; font-size: 16px; }
#ewo-app.ewo-mode-tablet .ewo-btn-primary,
#ewo-app.ewo-mode-tablet .ewo-btn-secondary {
  padding: 14px 22px;
  font-size: 15px;
}

/* === 5W+1H section === */
.ewo-5w1h {
  margin-top: 16px;
  border: 1px solid var(--ewo-border-1);
  border-radius: 10px;
  padding: 0;
  background: rgba(255,255,255,0.02);
}
.ewo-5w1h > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ewo-text-strong);
  user-select: none;
  list-style: none;
}
.ewo-5w1h > summary::-webkit-details-marker { display: none; }
.ewo-5w1h > summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--ewo-accent);
}
.ewo-5w1h[open] > summary::before { transform: rotate(90deg); }
.ewo-5w1h-body {
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ewo-5w-group {
  border: 1px solid rgba(249,115,22,0.18);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0;
}
.ewo-5w-group legend {
  font-size: 12px;
  font-weight: 700;
  color: var(--ewo-accent-light);
  padding: 0 8px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.ewo-5w-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
  font-size: 13px;
  flex-wrap: wrap;
}
.ewo-5w-row:last-child { border-bottom: none; }
.ewo-5w-q {
  color: var(--ewo-text-primary);
  flex: 1;
  min-width: 200px;
}
.ewo-5w-opts {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.ewo-5w-opts label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--ewo-text-secondary);
  font-size: 13px;
  white-space: nowrap;
}
.ewo-5w-opts input[type=radio] {
  accent-color: var(--ewo-accent);
  cursor: pointer;
}

/* Tablet: 5W rows на узких экранах — стек */
#ewo-app.ewo-mode-tablet .ewo-5w-row { flex-direction: column; align-items: flex-start; gap: 6px; }
#ewo-app.ewo-mode-tablet .ewo-5w-q { min-width: 0; font-size: 14px; }
#ewo-app.ewo-mode-tablet .ewo-5w-opts { flex-wrap: wrap; }
#ewo-app.ewo-mode-tablet .ewo-5w-opts label { font-size: 14px; padding: 4px 0; }

/* === Photos block === */
.ewo-photos-block { padding: 4px 0; }
.ewo-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 4px 0;
}
.ewo-photo-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ewo-surface-0);
  border: 1px solid var(--ewo-border-1);
  cursor: pointer;
}
.ewo-photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.ewo-photo-thumb:hover { border-color: var(--ewo-border-soft2); }
.ewo-photo-del {
  position: absolute;
  top: 4px; right: 4px;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(15,15,15,0.7);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.ewo-photo-del:hover { background: rgba(239,68,68,0.85); }
.ewo-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  border: 2px dashed var(--ewo-border-soft);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ewo-text-secondary);
  background: transparent;
  transition: all 0.15s;
}
.ewo-photo-add:hover {
  border-color: var(--ewo-border-soft2);
  background: var(--ewo-bg-soft);
  color: var(--ewo-text-strong);
}
.ewo-photo-add-icon { font-size: 28px; }
.ewo-photo-add-label { font-size: 12px; font-weight: 600; }
.ewo-photos-count {
  font-size: 11px;
  color: var(--ewo-text-muted);
  margin-top: 6px;
}

/* === Tablet wizard для создания EWO === */
.ewo-wizard {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.ewo-wizard-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--ewo-border-1);
  flex-shrink: 0;
}
.ewo-wizard-step-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ewo-accent-light);
  font-weight: 700;
}
.ewo-wizard-title {
  font-size: 22px;
  color: var(--ewo-text-strong);
  margin: 4px 0 10px;
  font-weight: 700;
}
.ewo-wizard-progress {
  background: rgba(255,255,255,0.06);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.ewo-wizard-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ewo-accent), var(--ewo-accent-light));
  transition: width 0.3s ease;
}
.ewo-wizard-content {
  flex: 1;
  overflow-y: auto; /* fallback если контент очень большой */
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.ewo-wizard-error {
  padding: 10px 14px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.5);
  color: #fca5a5;
  border-radius: 8px;
  font-size: 14px;
}
.ewo-wizard-footer {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--ewo-border-1);
  flex-shrink: 0;
  align-items: center;
  background: var(--ewo-surface-1);
}
.ewo-wizard-footer .ewo-btn-primary,
.ewo-wizard-footer .ewo-btn-secondary {
  flex: 1;
  font-size: 16px;
  padding: 14px 20px;
  min-height: 52px;
}
.ewo-wizard-footer .ewo-wizard-cancel {
  flex: 0 0 auto;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--ewo-text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.ewo-wizard-footer .ewo-wizard-cancel:hover {
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
}

/* «🏠 На главную» — вверху шапки мастера (всегда видно); confirm-on-discard на клике. */
.ewo-wizard-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  color: var(--ewo-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.ewo-wizard-home:hover,
.ewo-wizard-home:focus-visible {
  border-color: var(--ewo-accent);
  color: var(--ewo-accent-light);
  outline: none;
}
#ewo-app.ewo-mode-tablet .ewo-wizard-home { font-size: 15px; padding: 10px 18px; margin-bottom: 12px; }

/* Wizard step — крупные поля (touch-friendly) */
.ewo-wizard-content .ewo-input { padding: 14px 14px; font-size: 17px; }
.ewo-wizard-content label { font-size: 14px; }
.ewo-wizard-content .ewo-textarea { min-height: 80px; }

/* Tablet redesign Phase 1: cascade-reveal секции для wizard Step 1 (machine)
   и Step 2 (stop). Sections появляются по мере выбора пользователя. */
.ewo-wiz-cascade-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: ewo-wiz-reveal 0.25s ease;
}
.ewo-wiz-cascade-hidden { display: none !important; }
.ewo-wiz-section-title {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--ewo-accent-light);
  letter-spacing: 0.04em;
  margin: 0;
  font-weight: 700;
}
.ewo-wiz-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.ewo-wiz-tile {
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--ewo-text-primary);
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.3;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.ewo-wiz-tile:hover {
  border-color: var(--ewo-border-soft2);
  transform: translateY(-1px);
}
.ewo-wiz-tile:active { transform: translateY(0); }
.ewo-wiz-tile-selected {
  border-color: var(--ewo-accent);
  background: rgba(249, 115, 22, 0.14);
  color: #fed7aa;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.18);
}
.ewo-wiz-empty {
  padding: 14px;
  text-align: center;
  color: var(--ewo-text-muted);
  font-size: 14px;
  font-style: italic;
}

/* Time-presets row (Step 2) */
.ewo-wiz-time-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.ewo-wiz-time-tile { min-height: 56px; font-size: 15px; }
.ewo-wiz-time-display {
  font-size: 14px;
  color: var(--ewo-text-secondary);
  text-align: center;
  padding: 6px;
  min-height: 22px;
}

/* Disabled state кнопки «Далее» в footer wizard'а */
.ewo-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes ewo-wiz-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tablet — увеличенные плитки и поля */
#ewo-app.ewo-mode-tablet .ewo-wiz-tile { min-height: 72px; font-size: 17px; }
#ewo-app.ewo-mode-tablet .ewo-wiz-time-tile { min-height: 64px; }

/* Фаза 3 (28.05) — смена «Тип поломки»: inline-кнопка ✏️ в карточке +
   плитки в body-level модалке на планшете (вне #ewo-app — descendant-правило не достаёт). */
.ewo-bt-edit-btn {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 5px;
  border: 1px solid var(--ewo-border-1);
  background: var(--ewo-surface-2);
  color: var(--ewo-text-secondary);
  cursor: pointer;
  font-family: inherit;
  vertical-align: baseline;
  transition: border-color 0.15s, color 0.15s;
}
.ewo-bt-edit-btn:hover { border-color: var(--ewo-accent); color: var(--ewo-accent-light); }
#ewo-app.ewo-mode-tablet ~ .ewo-modal-overlay .ewo-wiz-tile,
.ewo-mode-tablet .ewo-modal-overlay .ewo-wiz-tile { min-height: 72px; font-size: 17px; }

/* 5W+1H в wizard режиме — крупные radio-tiles вместо мелких inline */
.ewo-wizard-q-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ewo-wizard-q-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
}
.ewo-wizard-q-text {
  font-size: 15px;
  color: var(--ewo-text-strong);
  line-height: 1.4;
}
.ewo-wizard-q-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ewo-wizard-q-options label {
  flex: 1;
  min-width: 76px;
  padding: 12px 8px;
  text-align: center;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ewo-text-secondary);
  background: rgba(255,255,255,0.02);
  transition: all 0.15s;
  user-select: none;
}
.ewo-wizard-q-options label:hover {
  border-color: var(--ewo-border-soft);
  color: var(--ewo-text-strong);
}
/* AUDIT_17 C13: visually-hidden вместо display:none — keep input в tab-order
   и accessibility-tree. Раньше keyboard-only пользователи и screen reader
   не могли отвечать на 5W+1H wizard вопросы (~24 шт): radio был полностью
   скрыт от keyboard navigation. Сейчас input невидим визуально, но focusable;
   обводка переходит на label через :focus-within. WCAG 2.1.1 Keyboard. */
.ewo-wizard-q-options input[type=radio] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.ewo-wizard-q-options label:focus-within {
  outline: 2px solid var(--ewo-accent);
  outline-offset: 2px;
}
.ewo-wizard-q-options label.ewo-wizard-q-checked-yes {
  border-color: rgba(16,185,129,0.6);
  color: #6ee7b7;
  background: rgba(16,185,129,0.08);
  font-weight: 600;
}
.ewo-wizard-q-options label.ewo-wizard-q-checked-no {
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
  background: rgba(239,68,68,0.06);
  font-weight: 600;
}
.ewo-wizard-q-options label.ewo-wizard-q-checked-other {
  border-color: var(--ewo-accent);
  color: var(--ewo-accent-light);
  background: var(--ewo-bg-soft);
  font-weight: 600;
}
.ewo-wizard-q-options label.ewo-wizard-q-checked-skip {
  border-color: rgba(160,160,160,0.4);
  color: var(--ewo-text-secondary);
  background: rgba(255,255,255,0.04);
}

/* Tablet redesign Phase 2: повышенный контраст заголовков и читаемость
   wizard-вопросов (только в tablet-режиме). На PC размеры остаются прежние. */
#ewo-app.ewo-mode-tablet .ewo-wizard-title {
  font-size: 26px;
  margin: 6px 0 12px;
}
#ewo-app.ewo-mode-tablet .ewo-wizard-step-label { font-size: 13px; }
#ewo-app.ewo-mode-tablet .ewo-wizard-q-row {
  padding: 14px;
  gap: 12px;
  background: rgba(255,255,255,0.03);
}
#ewo-app.ewo-mode-tablet .ewo-wizard-q-text {
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#ewo-app.ewo-mode-tablet .ewo-wizard-q-options label {
  min-width: 88px;
  padding: 14px 10px;
  font-size: 16px;
}

/* Review (последний шаг) — компактный список собранных данных */
.ewo-wizard-review {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ewo-wizard-review-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  gap: 16px;
}
.ewo-wizard-review-key { color: var(--ewo-text-secondary); font-size: 13px; flex-shrink: 0; }
.ewo-wizard-review-val {
  color: var(--ewo-text-strong);
  font-size: 14px;
  text-align: right;
  word-break: break-word;
}

/* === Task list cards (E6) === */
.ewo-task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ewo-task-list-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  justify-content: flex-start;
}

/* === Список EWO header (tablet — sticky сверху, кнопка «На главную» слева) === */
.ewo-list-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
  padding: 10px 16px !important;
}
.ewo-list-header-back {
  flex: 0 0 auto;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent-light);
  border: 1px solid var(--ewo-border-soft);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.ewo-list-header-back:hover {
  background: var(--ewo-bg-soft);
  border-color: var(--ewo-border-soft2);
  color: var(--ewo-text-strong);
}
.ewo-list-header-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.ewo-task-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: var(--ewo-surface-1);
  border: 1px solid var(--ewo-border-1);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  align-items: stretch;
}
.ewo-task-card:hover {
  border-color: var(--ewo-border-soft2);
  background: var(--ewo-surface-2);
  transform: translateY(-1px);
}
.ewo-task-card:focus-visible {
  outline: 2px solid var(--ewo-accent);
  outline-offset: 2px;
}
.ewo-task-card-thumb {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ewo-surface-0);
  border: 1px solid var(--ewo-border-1);
}
.ewo-task-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ewo-task-card-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--ewo-text-muted);
}
.ewo-task-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ewo-task-card-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.ewo-task-card-num {
  font-weight: 700;
  font-size: 16px;
  color: var(--ewo-accent-light);
  letter-spacing: 0.3px;
}
.ewo-task-card-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 11px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ewo-task-card-status.ewo-st-open      { background: rgba(245,158,11,0.18); color: #fcd34d; }
.ewo-task-card-status.ewo-st-progress  { background: rgba(59,130,246,0.18); color: #93c5fd; }
.ewo-task-card-status.ewo-st-done      { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.ewo-task-card-status.ewo-st-rejected  { background: rgba(107,114,128,0.18); color: #d1d5db; }
/* Пауза/возобновление (30.05): янтарь + inset-рамка отличает от «Открыто» (тоже янтарь). */
.ewo-task-card-status.ewo-st-paused    { background: rgba(245,158,11,0.20); color: #fbbf24; box-shadow: inset 0 0 0 1px rgba(245,158,11,0.55); }
.ewo-task-card-line {
  font-size: 13px;
  color: var(--ewo-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ewo-task-card-type {
  font-size: 13px;
  color: var(--ewo-text-secondary);
}
.ewo-task-card-meta {
  font-size: 11px;
  color: var(--ewo-text-muted);
  margin-top: auto;
}

/* Tablet: крупнее тапаемая карточка */
#ewo-app.ewo-mode-tablet .ewo-task-card {
  padding: 14px;
  gap: 16px;
}
#ewo-app.ewo-mode-tablet .ewo-task-card-thumb { width: 100px; height: 100px; }
#ewo-app.ewo-mode-tablet .ewo-task-card-num { font-size: 18px; }
#ewo-app.ewo-mode-tablet .ewo-task-card-line,
#ewo-app.ewo-mode-tablet .ewo-task-card-type { font-size: 14px; }

/* === Detail view (E6) === */
.ewo-detail-scroll {
  overflow-y: auto;
  display: block;
  padding: 16px 20px 24px;
}
.ewo-detail-section {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.ewo-detail-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ewo-accent-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ewo-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 18px;
  font-size: 14px;
  color: var(--ewo-text-primary);
}
.ewo-detail-grid b { color: var(--ewo-text-secondary); font-weight: 600; margin-right: 6px; }
.ewo-detail-text {
  font-size: 14px;
  color: var(--ewo-text-primary);
  white-space: pre-wrap;
  line-height: 1.5;
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.ewo-detail-text b { color: var(--ewo-text-secondary); font-weight: 600; }

/* History */
.ewo-detail-history { display: flex; flex-direction: column; gap: 6px; }
.ewo-detail-history-row {
  display: grid;
  grid-template-columns: 150px 160px 130px 1fr;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  align-items: baseline;
}
.ewo-detail-history-row:last-child { border-bottom: none; }
.ewo-detail-history-time { color: var(--ewo-text-muted); }
.ewo-detail-history-action { color: var(--ewo-accent-light); font-weight: 600; }
.ewo-detail-history-user { color: var(--ewo-text-secondary); }
.ewo-detail-history-detail { color: var(--ewo-text-primary); }
@media (max-width: 768px) {
  .ewo-detail-history-row { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
}

/* === E10: подробная сводка времён в детальной карточке === */
.ewo-timing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ewo-timing-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.ewo-timing-card-total {
  background: linear-gradient(135deg, rgba(249,115,22,0.12), rgba(249,115,22,0.04));
  border-color: var(--ewo-border-soft);
}
.ewo-timing-card-label {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.ewo-timing-card-value {
  font-size: 20px;
  color: var(--ewo-text-strong);
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.ewo-timing-card-total .ewo-timing-card-value {
  color: var(--ewo-accent-light);
}
/* Пауза/возобновление (30.05): янтарная карта «⏸ На паузе» + список сегментов ремонта. */
.ewo-timing-card-pause {
  background: linear-gradient(135deg, rgba(245,158,11,0.14), rgba(245,158,11,0.04));
  border-color: rgba(245,158,11,0.45);
}
.ewo-timing-card-pause .ewo-timing-card-value { color: #fbbf24; }
.ewo-rep-segments {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.07);
}
.ewo-rep-segments-label {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}
.ewo-rep-seg-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.ewo-rep-seg-row:first-of-type { border-top: none; }
.ewo-rep-seg-who { color: var(--ewo-text-primary); }
.ewo-rep-seg-dur { color: var(--ewo-text-strong); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ewo-rep-seg-open { color: #fbbf24; font-weight: 700; font-size: 11px; }
/* Пояснение баланса (30.05): ожидание (от остановки) + ремонт = простой. Под карточками времени. */
.ewo-timing-balance {
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.06);
  border: 1px solid var(--ewo-border-soft, rgba(255,255,255,0.08));
  border-left: 3px solid var(--ewo-accent);
}
.ewo-timing-balance-eq {
  font-size: 13.5px;
  color: var(--ewo-text-primary);
  line-height: 1.6;
}
.ewo-timing-balance-eq b { color: var(--ewo-text-strong); font-variant-numeric: tabular-nums; }
.ewo-timing-balance-sub { color: var(--ewo-text-muted); font-size: 11.5px; }
.ewo-timing-balance-pause { color: #fbbf24; white-space: nowrap; }
.ewo-timing-balance-note {
  font-size: 11.5px;
  color: var(--ewo-text-muted);
  margin-top: 5px;
  line-height: 1.45;
}
/* Подстрока «Отклик на заявку» в карточке «Среднее ожидание» статистики (30.05). */
.ewo-stats-kpi-large-subline {
  margin-top: 7px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--ewo-border-soft, rgba(255,255,255,0.08));
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  line-height: 1.4;
}
.ewo-stats-kpi-large-subline b { color: var(--ewo-text-strong); font-variant-numeric: tabular-nums; }
.ewo-stats-kpi-large-subnote { display: block; color: var(--ewo-text-muted); font-size: 11px; margin-top: 2px; }
.ewo-timing-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ewo-timing-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.ewo-timing-stage-label {
  color: var(--ewo-text-secondary);
}
.ewo-timing-stage-val {
  color: var(--ewo-accent-light);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* === E7: Repair / Analysis / Countermeasures sections === */
.ewo-section-edit-btn,
.ewo-section-revise-part-a-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
}
/* CTA-вариант «✏️ Заполнить/Редактировать» (Ремонт/Анализ в активном потоке) —
   filled-orange бренд = «главное действие продолжить». !important — перебить
   tablet id-override .ewo-btn-secondary. Архив/Контрмеры/Уточнить Часть A не задеты. */
.ewo-section-edit-cta {
  background: var(--ewo-accent) !important;
  color: #fff !important;
  border-color: var(--ewo-accent) !important;
  font-weight: 700 !important;
}
.ewo-section-edit-cta:hover {
  background: var(--ewo-accent-dark) !important;
  border-color: var(--ewo-accent-dark) !important;
}
.ewo-section-edit-cta:focus-visible {
  background: var(--ewo-accent-dark) !important;
  border-color: var(--ewo-accent-dark) !important;
  outline: 2px solid var(--ewo-accent-light);
  outline-offset: 2px;
}
/* Подсказка-баннер «▶ Продолжите…» под заголовком пустой секции Ремонт/Анализ. */
.ewo-section-next-hint {
  margin-top: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ewo-accent-light);
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-left: 3px solid var(--ewo-accent);
  border-radius: 8px;
}
#ewo-app.ewo-mode-tablet .ewo-section-next-hint { font-size: 14px; padding: 10px 14px; }
.ewo-workshop-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ewo-bg-soft2);
  color: var(--ewo-text-strong);
  border: 1px solid var(--ewo-border-soft);
  font-size: 15px;
  font-weight: 600;
}
.ewo-temp-fix-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 11px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.ewo-parts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 13px;
}
.ewo-parts-table th,
.ewo-parts-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--ewo-text-primary);
  vertical-align: top;
}
.ewo-parts-table th {
  color: var(--ewo-text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ewo-parts-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* Строка-карточка запчасти (форма ремонта) — 4 поля: № каталога / Описание / Кол-во / 🗑.
   Desktop — одна строка; ≤768px — карточка-стопка (медиа-запрос ниже). */
.ewo-rep-part-row {
  display: grid;
  grid-template-columns: 1fr 2fr 80px 36px;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}

/* Tablet narrow — сжатые отступы в таблицах */
@media (max-width: 768px) {
  .ewo-parts-table th, .ewo-parts-table td { padding: 5px 6px; font-size: 12px; }
  .ewo-ana-cause-row { grid-template-columns: 1fr 32px !important; gap: 4px !important; }
  .ewo-cms-row { grid-template-columns: 1fr 32px !important; gap: 4px !important; }
  /* Запчасть ≤768px — карточка: «№ каталога» и «Описание» на всю ширину,
     «Кол-во» + кнопка удаления — нижней строкой. Чинит баг, где 4 поля в
     сетке 1fr 32px ломались на 2 ряда с раздавленным до 32px «Описание». */
  .ewo-rep-part-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--ewo-border-1);
    border-radius: 10px;
    background: var(--ewo-surface-1);
  }
  .ewo-rep-part-row > [data-fld="catalogNo"],
  .ewo-rep-part-row > [data-fld="description"] { grid-column: 1 / -1; }
  .ewo-rep-part-row > [data-fld="qty"] { max-width: 160px; }
  .ewo-rep-part-row > [data-rm] { min-width: 44px; min-height: 40px; }
}

/* 5W+1H readonly summary */
.ewo-5w-readonly-block {
  margin-bottom: 10px;
}
.ewo-5w-readonly-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ewo-accent);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ewo-5w-readonly-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  gap: 12px;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.ewo-5w-readonly-row:last-child { border-bottom: none; }
.ewo-5w-readonly-q { color: var(--ewo-text-secondary); flex: 1; }
.ewo-5w-readonly-a { font-weight: 600; }
.ewo-5w-readonly-yes  { color: #6ee7b7; }
.ewo-5w-readonly-no   { color: #fca5a5; }
.ewo-5w-readonly-enum { color: var(--ewo-accent-light); }

/* === E8: центрированный toast (заметнее обычного renderToast) === */
.ewo-center-toast {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 20px;
  animation: ewo-center-toast-fade-in 0.18s ease;
}
.ewo-center-toast-leaving {
  animation: ewo-center-toast-fade-out 0.2s ease forwards;
}
@keyframes ewo-center-toast-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ewo-center-toast-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
.ewo-center-toast-msg {
  position: relative;
  max-width: 540px;
  padding: 24px 56px 24px 28px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
  box-shadow: 0 16px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.12);
  text-align: center;
  animation: ewo-center-toast-pop 0.22s ease;
}
@keyframes ewo-center-toast-pop {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ewo-center-toast-success .ewo-center-toast-msg { background: linear-gradient(135deg, #10b981, #059669); }
.ewo-center-toast-warning .ewo-center-toast-msg { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ewo-center-toast-error   .ewo-center-toast-msg { background: linear-gradient(135deg, #ef4444, #dc2626); }
.ewo-center-toast-info    .ewo-center-toast-msg { background: linear-gradient(135deg, #3b82f6, #2563eb); }

.ewo-center-toast-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ewo-center-toast-close:hover { background: rgba(255, 255, 255, 0.35); }

/* === Modal overlay (E8 reject + future modals) === */
.ewo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ewo-center-toast-fade-in 0.18s ease;
}
.ewo-modal {
  background: var(--ewo-surface-1);
  border: 1px solid var(--ewo-border-1);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(249, 115, 22, 0.18);
  animation: ewo-center-toast-pop 0.22s ease;
  overflow: hidden;
}
.ewo-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ewo-border-1);
  flex-shrink: 0;
}
.ewo-modal-header h2 {
  margin: 0;
  font-size: 17px;
  color: var(--ewo-text-strong);
  font-weight: 700;
}
.ewo-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ewo-text-secondary);
  font-size: 22px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.ewo-modal-close:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}
.ewo-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.ewo-modal-message {
  font-size: 15px;
  color: var(--ewo-text-strong);
  line-height: 1.55;
  white-space: pre-wrap;
}
.ewo-modal-info {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  line-height: 1.6;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ewo-modal-info b { color: var(--ewo-text-primary); }
.ewo-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ewo-border-1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Tablet — модал шире, кнопки крупнее */
#ewo-app.ewo-mode-tablet ~ .ewo-modal-overlay .ewo-modal,
.ewo-mode-tablet .ewo-modal-overlay .ewo-modal {
  max-width: 720px;
  max-height: calc(100vh - 32px);
}
@media (max-width: 768px) {
  .ewo-modal { max-width: 100%; max-height: calc(100vh - 16px); }
  .ewo-modal-header h2 { font-size: 15px; }
  .ewo-modal-footer { flex-direction: column-reverse; }
  .ewo-modal-footer .ewo-btn-primary,
  .ewo-modal-footer .ewo-btn-secondary { width: 100%; padding: 14px; font-size: 16px; }
  .ewo-center-toast-msg { font-size: 16px; padding: 20px 48px 20px 22px; }
}

/* === E9: Archive view === */
.ewo-arch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.ewo-arch-toolbar .ewo-input {
  padding: 8px 10px;
  font-size: 13px;
}
.ewo-arch-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ewo-text-secondary);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.ewo-arch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  overflow: hidden;
}
.ewo-arch-table th,
.ewo-arch-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--ewo-text-primary);
  vertical-align: middle;
}
.ewo-arch-table th {
  background: rgba(0,0,0,0.2);
  color: var(--ewo-text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  position: sticky;
  top: 0;
}
.ewo-arch-table tbody tr.ewo-arch-row {
  cursor: pointer;
  transition: background 0.12s;
}
.ewo-arch-table tbody tr.ewo-arch-row:hover {
  background: rgba(249,115,22,0.06);
}
.ewo-arch-cb-col { width: 36px; text-align: center !important; }
.ewo-arch-cms-yes {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
/* Трёхуровневая ячейка длительности в таблице «Все EWO»:
   ⏱ общий простой (большой, сверху) = ⏳ ожидание + 🔧 ремонт. */
.ewo-cell-duration {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ewo-cell-dur-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--ewo-text-strong);
}
.ewo-cell-dur-wait {
  font-size: 12px;
  font-weight: 500;
  color: var(--ewo-text-muted);
}
.ewo-cell-dur-repair {
  font-size: 12px;
  font-weight: 500;
  color: var(--ewo-accent-light);
}

.ewo-time-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.ewo-time-quick-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--ewo-text-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.ewo-time-quick-btn:hover {
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent-light);
  border-color: var(--ewo-border-soft2);
}
/* Стойкая подсветка выбранной quick-time кнопки (toggle в ewoWireTimeQuickButtons). */
.ewo-time-quick-btn.active {
  background: rgba(249, 115, 22, 0.16);
  border-color: var(--ewo-accent);
  color: #fed7aa;
  font-weight: 600;
}
#ewo-app.ewo-mode-tablet .ewo-time-quick-btn {
  padding: 8px 14px;
  font-size: 14px;
}

/* «Время ремонта» — блок с двумя колонками (Начало / Окончание) */
.ewo-rep-timing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 6px;
}
@media (max-width: 768px) {
  .ewo-rep-timing-grid { grid-template-columns: 1fr; }
}
.ewo-rep-timing-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
}
.ewo-rep-timing-label {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  margin-bottom: 6px;
}
.ewo-rep-timing-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  font-variant-numeric: tabular-nums;
}
.ewo-rep-timing-value-pending {
  font-size: 14px;
  color: var(--ewo-text-muted);
  padding: 8px 0;
}
.ewo-rep-timing-hint {
  font-size: 11px;
  color: var(--ewo-text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* === C1 redistribute UI: длительности этапов ремонта === */
.ewo-rep-times-hint {
  font-size: 12px;
  color: var(--ewo-text-muted);
  line-height: 1.5;
  margin: 4px 0 10px 0;
}
.ewo-rep-times-hint b {
  color: var(--ewo-text-strong);
  font-weight: 700;
}
/* Поле, которое сейчас auto-calc (нет в _ewoRepairLockedKeys) — приглушённый стиль + ⚙️ */
.ewo-input.ewo-rep-time-auto {
  background: rgba(255, 165, 0, 0.06);
  border-color: rgba(255, 165, 0, 0.35);
  color: var(--ewo-text-secondary);
  font-style: italic;
}
.ewo-input.ewo-rep-time-auto::placeholder { color: var(--ewo-text-muted); }
/* Сводка по сумме — зелёная (✓) или жёлтая (⚠️) */
.ewo-rep-sum-indicator {
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
/* AUDIT_17 L02 (Sprint B5): #16a34a даёт ~3.4:1 на белом и недостаточно
   контрастен на тёмной EWO-теме (slate-900). #22c55e (green-500) контрастнее
   на dark bg (~6.7:1) — passes WCAG AA для normal text. */
.ewo-rep-sum-indicator.ewo-rep-sum-ok {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.ewo-rep-sum-indicator.ewo-rep-sum-warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* === Save-summary карточка распределения времени перед кнопкой «Сохранить» ===
   Акцент для оператора чтобы убедиться в распределении ДО фиксации значений.
   Амбер-палитра (warning, не error — данные корректны, нужно лишь обратить внимание).
   Лёгкий pulse-glow привлекает взгляд; в open-состоянии формы карточка
   находится прямо над wizard-footer / PC actions row. */
.ewo-rep-save-summary {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid rgba(245, 158, 11, 0.55);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10) 0%, rgba(245, 158, 11, 0.03) 100%);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.20), 0 6px 20px rgba(245, 158, 11, 0.12);
  animation: ewoRepSaveSummaryPulse 2.6s ease-in-out infinite;
}
.ewo-rep-save-summary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ewo-rep-save-summary-icon { font-size: 22px; line-height: 1; }
.ewo-rep-save-summary-title {
  font-size: 15px;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.01em;
}
.ewo-rep-save-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.ewo-rep-save-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ewo-rep-save-summary-label {
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  font-weight: 600;
}
.ewo-rep-save-summary-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  font-variant-numeric: tabular-nums;
}
.ewo-rep-save-summary-total {
  font-size: 14px;
  color: var(--ewo-text-strong);
  padding: 8px 0;
  border-top: 1px dashed rgba(245, 158, 11, 0.25);
  border-bottom: 1px dashed rgba(245, 158, 11, 0.25);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.ewo-rep-save-summary-hint {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  line-height: 1.5;
}
@keyframes ewoRepSaveSummaryPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.20), 0 6px 20px rgba(245, 158, 11, 0.12); }
  50%      { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.40), 0 8px 28px rgba(245, 158, 11, 0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .ewo-rep-save-summary { animation: none; }
}
@media (max-width: 700px) {
  .ewo-rep-save-summary-grid { grid-template-columns: 1fr; gap: 6px; }
  .ewo-rep-save-summary-val { font-size: 16px; }
}
/* Бейдж «🔒 Длительности зафиксированы» */
.ewo-rep-times-locked-badge {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0 10px 0;
  line-height: 1.5;
}
/* Read-only визуал поля длительности */
.ewo-input.ewo-rep-time[readonly] {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ewo-text-secondary);
  cursor: default;
  border-style: dashed;
}
.ewo-btn-unlock-times {
  font-size: 12px;
}

.ewo-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  filter: grayscale(0.4);
}

.ewo-btn-repair-start {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}
.ewo-btn-repair-start:hover { background: #2563eb !important; border-color: #2563eb !important; }
.ewo-btn-repair-end {
  background: #8b5cf6 !important;
  border-color: #8b5cf6 !important;
}
.ewo-btn-repair-end:hover { background: #7c3aed !important; border-color: #7c3aed !important; }

/* Tablet redesign Phase 3: новый layout формы ремонта.
   Применяется и в tablet, и в PC (унифицированный порядок секций). */

/* 1. Начало работ (принято) — компактный info-блок. */
.ewo-rep-start-block {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid #3b82f6;
}
.ewo-rep-start-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ewo-text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}
.ewo-rep-start-value {
  font-size: 16px;
  color: var(--ewo-text-strong);
  font-weight: 600;
}
.ewo-rep-start-pending {
  font-size: 14px;
  color: var(--ewo-text-muted);
  font-style: italic;
}

/* 2. ⚠️ Временное решение — plitka-toggle. */
.ewo-rep-temp-toggle {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 18px 22px;
  border-radius: 14px;
  cursor: pointer;
  border: 2px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.01));
  color: var(--ewo-text-primary);
  font-family: inherit;
  text-align: left;
  transition: all 0.2s;
}
.ewo-rep-temp-toggle:hover { border-color: rgba(245, 158, 11, 0.55); }
.ewo-rep-temp-toggle.ewo-rep-temp-on {
  border-color: rgba(245, 158, 11, 0.75);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.06));
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
}
.ewo-rep-temp-icon { font-size: 28px; line-height: 1; }
.ewo-rep-temp-label {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  color: var(--ewo-text-strong);
}
.ewo-rep-temp-state {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--ewo-text-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.ewo-rep-temp-toggle.ewo-rep-temp-on .ewo-rep-temp-state {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* 5. Длительности — компактные узкие. */
.ewo-rep-times-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0;
}
.ewo-rep-time-item { display: flex; flex-direction: column; align-items: center; }
.ewo-rep-time-item label {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  margin-bottom: 4px;
  text-align: center;
  font-weight: 600;
}
.ewo-rep-time-narrow {
  width: 100% !important;
  max-width: 90px;
  margin: 0 auto;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 18px !important;
  padding: 10px !important;
}
.ewo-rep-times-auto-hint {
  font-size: 12px;
  color: var(--ewo-text-muted);
  text-align: center;
  margin: 4px 0 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  line-height: 1.4;
}

/* 6. Finish-block — нижняя секция с кнопкой «🏁 Завершить ремонт». */
.ewo-rep-finish-block {
  margin-top: 4px;
  padding: 18px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.ewo-rep-finish-block.ewo-rep-finish-done {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}
.ewo-rep-finish-done-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #6ee7b7;
  font-weight: 700;
  margin-bottom: 4px;
}
.ewo-rep-finish-done-value {
  font-size: 16px;
  color: var(--ewo-text-strong);
  font-weight: 600;
}
.ewo-btn-finish-repair {
  width: 100%;
  padding: 18px !important;
  font-size: 18px !important;
  font-weight: 700;
}
.ewo-rep-end-hint {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
}
/* Пауза/возобновление (30.05): янтарная «⏸ Приостановить работу».
   .ewo-rep-pause-btn — finish-секция формы ремонта (full-width); .ewo-detail-pause-btn — actions row detail-view. */
.ewo-rep-pause-btn { width: 100%; }
.ewo-rep-pause-btn,
.ewo-detail-pause-btn {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}
.ewo-rep-pause-btn:hover,
.ewo-detail-pause-btn:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

@media (max-width: 600px) {
  .ewo-rep-times-compact { grid-template-columns: 1fr 1fr; }
  .ewo-rep-temp-toggle { padding: 14px 16px; }
  .ewo-rep-temp-icon { font-size: 24px; }
}

/* Tablet redesign Phase 4: форма анализа корневой причины (5 Whys cascade
   + категория cascade + primary cascade). Только tablet-режим. */
.ewo-ana-section {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--ewo-border-soft);
  background: rgba(255, 255, 255, 0.02);
}
.ewo-ana-section legend {
  font-size: 14px;
  font-weight: 700;
  color: var(--ewo-accent-light);
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ewo-ana-cascade-hidden { display: none !important; }

.ewo-ana-five-whys {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ewo-ana-why-row {
  animation: ewo-ana-reveal 0.25s ease;
}
.ewo-ana-why-hidden { display: none !important; }
.ewo-ana-why-row label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ewo-text-strong);
  margin-bottom: 6px;
}
.ewo-ana-why-row textarea { min-height: 60px; }

.ewo-ana-category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.ewo-ana-primary-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.ewo-ana-tile {
  min-height: 64px;
  padding: 14px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  color: var(--ewo-text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.ewo-ana-tile:hover {
  border-color: var(--ewo-border-soft2);
  transform: translateY(-1px);
}
.ewo-ana-tile:active { transform: translateY(0); }
.ewo-ana-tile-selected {
  border-color: var(--ewo-accent);
  background: rgba(249, 115, 22, 0.14);
  color: #fed7aa;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.18);
}

@keyframes ewo-ana-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

#ewo-app.ewo-mode-tablet .ewo-ana-tile { min-height: 72px; font-size: 15px; }

/* Tablet redesign Phase 6C: hint в legend + legacy-banner. */
.ewo-ana-section-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--ewo-text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}
.ewo-ana-legacy-banner {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  color: var(--ewo-text-primary);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
/* Phase 7A: подсказка над шагом wizard'а анализа. */
.ewo-ana-step-hint {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid #3b82f6;
  color: var(--ewo-text-primary);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
}
#ewo-app.ewo-mode-tablet .ewo-ana-step-hint { font-size: 15px; padding: 12px 16px; }

/* Live-счётчик «N из 3 (минимум)» внутри hint шага 1 (5 Whys). */
.ewo-ana-why-counter {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ewo-ana-counter-warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.ewo-ana-counter-ok {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.3);
}
#ewo-app.ewo-mode-tablet .ewo-ana-why-counter { font-size: 14px; padding: 6px 12px; }

/* Hint под textarea описания корневой причины (шаг 2). */
.ewo-ana-desc-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ewo-text-muted);
}

/* AUDIT_17 L34 (Sprint EWO-M4): live-counter «N / MAX» под длинными textareas. */
.ewo-textarea-counter {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ewo-text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* === Чеклист требований активации «💾 Сохранить» (шаг 2 анализа) ===
   Без него пользователь не понимает почему кнопка серая. Когда все ✓ —
   блок становится зелёным («можно сохранять»). */
.ewo-ana-requirements {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
  transition: border-color 0.2s, background 0.2s;
}
.ewo-ana-requirements.ewo-ana-req-all-met {
  border-color: rgba(22, 163, 74, 0.55);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.10) 0%, rgba(22, 163, 74, 0.02) 100%);
}
.ewo-ana-req-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.ewo-ana-requirements.ewo-ana-req-all-met .ewo-ana-req-title { color: #4ade80; }
.ewo-ana-req-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--ewo-text-secondary);
  line-height: 1.4;
}
.ewo-ana-req-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--ewo-text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.ewo-ana-req-item.ewo-ana-req-met { color: var(--ewo-text-strong); }
.ewo-ana-req-item.ewo-ana-req-met .ewo-ana-req-mark {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.45);
}
.ewo-ana-req-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
#ewo-ana-req-desc-len { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ewo-text-strong); }
#ewo-app.ewo-mode-tablet .ewo-ana-req-title { font-size: 15px; }
#ewo-app.ewo-mode-tablet .ewo-ana-req-item { font-size: 15px; padding: 8px 0; }
#ewo-app.ewo-mode-tablet .ewo-ana-req-mark { width: 26px; height: 26px; font-size: 14px; }

/* Tablet redesign Phase 5/6: compact 5 Whys list (read-only). */
.ewo-detail-five-whys-block {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border-left: 3px solid var(--ewo-accent);
}
.ewo-detail-five-whys-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ewo-accent-light);
  font-weight: 700;
  margin-bottom: 4px;
}
.ewo-detail-five-whys {
  margin: 0;
  padding-left: 22px;
  color: var(--ewo-text-primary);
  font-size: 13px;
  line-height: 1.4;
}
.ewo-detail-five-whys li {
  margin-bottom: 2px;
  padding-left: 2px;
}
.ewo-detail-five-whys li::marker {
  color: var(--ewo-accent-light);
  font-weight: 700;
}

/* Phase C2: collapsible summary блоки Часть A / Часть B в analysis-секции
   detail-view. Open by default (контент важен для engineer'а при ремонте).
   2-col grid на широких экранах, стак на mobile/tablet. */
.ewo-detail-partA-summary,
.ewo-detail-partB-summary {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border-left: 3px solid var(--ewo-accent);
}
.ewo-detail-partA-summary > summary,
.ewo-detail-partB-summary > summary {
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--ewo-text-secondary);
  padding: 2px 0;
}
.ewo-detail-partA-summary > summary > b,
.ewo-detail-partB-summary > summary > b {
  color: var(--ewo-text-strong);
}
.ewo-detail-partA-summary[open] > summary,
.ewo-detail-partB-summary[open] > summary { margin-bottom: 8px; }
.ewo-detail-partA-grid,
.ewo-detail-partB-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--ewo-text-primary);
}
.ewo-detail-partA-grid > div,
.ewo-detail-partB-grid > div { padding: 2px 0; }
.ewo-detail-partA-grid > div > b,
.ewo-detail-partB-grid > div > b { color: var(--ewo-text-secondary); margin-right: 4px; }
@media (max-width: 700px) {
  .ewo-detail-partA-grid,
  .ewo-detail-partB-grid { grid-template-columns: 1fr; }
}

/* Phase D1: merged 5W+1H block для archive view (Variant D-2). 5 категорий
   с inline border-left маркером Part A (orange) / Part B (blue). Reading-oriented
   layout — без collapsible, всё видно сразу. 2-col rows на широких экранах. */
.ewo-merged-fivew-block {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ewo-merged-fivew-category {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}
.ewo-merged-fivew-cat-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ewo-accent-light);
  font-weight: 800;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ewo-merged-fivew-row {
  font-size: 13px;
  color: var(--ewo-text-primary);
  padding: 4px 8px 4px 10px;
  margin-bottom: 3px;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
  background: rgba(255, 255, 255, 0.015);
}
.ewo-merged-fivew-row-a { border-left-color: var(--ewo-accent); }
.ewo-merged-fivew-row-b { border-left-color: #3b82f6; }
/* Phase D2: legacy isDamaged row — muted + italic, fact preserved для forward-only. */
.ewo-merged-fivew-row-legacy {
  border-left-color: var(--ewo-text-muted);
  opacity: 0.65;
  font-style: italic;
}
.ewo-merged-fivew-legacy-tag {
  color: var(--ewo-text-muted);
  font-size: 11px;
  margin-left: 6px;
}
.ewo-merged-fivew-q {
  color: var(--ewo-text-secondary);
  font-weight: 600;
  margin-right: 4px;
}
.ewo-merged-fivew-footer {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  line-height: 1.5;
}
.ewo-merged-fivew-footer-legacy {
  font-style: italic;
  color: var(--ewo-text-muted);
}
.ewo-merged-fivew-credit { display: inline-block; }
.ewo-merged-fivew-credit-a > b { color: var(--ewo-accent-light); }
.ewo-merged-fivew-credit-b > b { color: #93c5fd; }
.ewo-merged-fivew-credit-when {
  color: var(--ewo-text-muted);
  font-size: 11.5px;
  margin-left: 2px;
}

/* 2-col layout для категорий с большим числом вопросов (whatWhere ×9, who ×4, which ×4). */
@media (min-width: 1100px) {
  .ewo-merged-fivew-category {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    align-items: start;
  }
  .ewo-merged-fivew-cat-title { grid-column: 1 / -1; }
}

/* Phase 6E: approve-status pill в таблицах «Все EWO» и «Архив». */
.ewo-cms-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
.ewo-cms-approve-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.ewo-cms-approve-pill.ewo-cms-approved {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.ewo-cms-approve-pill.ewo-cms-pending {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Phase 7B: статистика «Корневые причины (тип → основная)». */
.ewo-stats-rch {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ewo-stats-rch-category {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  border-left: 4px solid var(--rch-color, #16a34a);
}
.ewo-stats-rch-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ewo-stats-rch-cat-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ewo-text-strong);
}
.ewo-stats-rch-cat-count {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  font-variant-numeric: tabular-nums;
}
.ewo-stats-rch-primaries {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ewo-stats-rch-primary {
  position: relative;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}
.ewo-stats-rch-primary-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  opacity: 0.18;
  transition: width 0.3s ease;
  z-index: 0;
}
.ewo-stats-rch-primary-row {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ewo-stats-rch-primary-name {
  font-size: 14px;
  color: var(--ewo-text-primary);
  font-weight: 500;
}
.ewo-stats-rch-primary-count {
  font-size: 13px;
  color: var(--ewo-text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ewo-stats-rch-empty {
  font-size: 12px;
  color: var(--ewo-text-muted);
  font-style: italic;
  padding: 4px 8px;
}
.ewo-stats-rch-legacy {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.05);
  border: 1px dashed rgba(245, 158, 11, 0.3);
}
.ewo-stats-rch-legacy-title {
  font-size: 12px;
  font-weight: 700;
  color: #fcd34d;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ewo-stats-rch-legacy-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ewo-text-secondary);
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.ewo-stats-rch-legacy-row:last-child { border-bottom: none; }

/* ====================================================================
   Tablet contrast boost — Phase 6 follow-up.
   Цех шумный, операторы отвлекаются → весь UI должен читаться
   с расстояния и при беглом взгляде. Применяется только к tablet
   (#ewo-app.ewo-mode-tablet ...), PC остаётся как было.
   ==================================================================== */
#ewo-app.ewo-mode-tablet {
  /* Базовый текст крупнее. */
  font-size: 16px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-section {
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 12px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-section h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ewo-accent-light);
  margin-bottom: 10px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-grid {
  font-size: 16px;
  gap: 10px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-grid b,
#ewo-app.ewo-mode-tablet .ewo-detail-text b {
  color: #fef3c7;  /* warm-yellow для ярких labels */
  font-weight: 700;
}
#ewo-app.ewo-mode-tablet .ewo-detail-text {
  font-size: 16px;
  line-height: 1.5;
  color: #f5f5f4;
}
/* Все плитки и большие карточки в tablet — ярче, читаемее. */
#ewo-app.ewo-mode-tablet .ewo-tile-title { font-size: 22px; font-weight: 800; }
#ewo-app.ewo-mode-tablet .ewo-tile-subtitle { font-size: 14px; }
#ewo-app.ewo-mode-tablet .ewo-task-card { padding: 16px 18px; }
#ewo-app.ewo-mode-tablet .ewo-task-card-status {
  font-size: 13px;
  padding: 4px 10px;
  font-weight: 700;
}
/* История EWO + history-row в tablet. */
#ewo-app.ewo-mode-tablet .ewo-detail-history-row {
  font-size: 14px;
  padding: 8px 0;
}
/* Контрмеры в tablet — крупнее и контрастнее. */
#ewo-app.ewo-mode-tablet .ewo-cms-auto-card {
  padding: 18px 22px;
  border-width: 2px;
}
#ewo-app.ewo-mode-tablet .ewo-cms-auto-label { font-size: 14px; }
#ewo-app.ewo-mode-tablet .ewo-cms-auto-cause { font-size: 16px; }
#ewo-app.ewo-mode-tablet .ewo-cms-auto-action { font-size: 17px; }
#ewo-app.ewo-mode-tablet .ewo-cms-approved-badge {
  padding: 8px 14px;
  font-size: 14px;
}
/* 5 Whys в tablet — ярче. */
#ewo-app.ewo-mode-tablet .ewo-detail-five-whys-block {
  padding: 12px 16px;
  border-left-width: 4px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-five-whys-label {
  font-size: 13px;
}
#ewo-app.ewo-mode-tablet .ewo-detail-five-whys {
  font-size: 16px;
  line-height: 1.5;
}
/* Plitki в repair-temp-toggle — ярче в tablet. */
#ewo-app.ewo-mode-tablet .ewo-rep-temp-toggle { padding: 22px 24px; border-width: 3px; }
#ewo-app.ewo-mode-tablet .ewo-rep-temp-icon { font-size: 36px; }
#ewo-app.ewo-mode-tablet .ewo-rep-temp-label { font-size: 19px; }
#ewo-app.ewo-mode-tablet .ewo-rep-temp-state { font-size: 15px; padding: 8px 14px; }
/* Кнопка «Завершить ремонт» в tablet — крупная и чётко видна. */
#ewo-app.ewo-mode-tablet .ewo-btn-finish-repair {
  font-size: 22px !important;
  padding: 22px !important;
  letter-spacing: 0.02em;
}
#ewo-app.ewo-mode-tablet .ewo-rep-finish-block {
  padding: 22px;
  border-width: 2px;
}
/* Plitki в analysis form — ярче в tablet. */
#ewo-app.ewo-mode-tablet .ewo-ana-section legend {
  font-size: 16px;
  font-weight: 800;
  padding: 4px 12px;
  background: rgba(249, 115, 22, 0.10);
  border-radius: 6px;
}
#ewo-app.ewo-mode-tablet .ewo-ana-tile {
  font-size: 16px;
  font-weight: 600;
}
#ewo-app.ewo-mode-tablet .ewo-ana-tile-selected {
  border-width: 3px;
}
#ewo-app.ewo-mode-tablet .ewo-ana-why-row label {
  font-size: 16px;
  font-weight: 700;
  color: #fef3c7;
}
#ewo-app.ewo-mode-tablet .ewo-ana-why-row textarea { min-height: 80px; font-size: 16px; }
#ewo-app.ewo-mode-tablet .ewo-ana-section { padding: 18px 20px; }

/* Wizard plitki контраст в tablet. */
#ewo-app.ewo-mode-tablet .ewo-wiz-tile-selected {
  border-width: 3px;
  font-size: 18px;
}
#ewo-app.ewo-mode-tablet .ewo-wiz-section-title {
  font-size: 15px;
  font-weight: 800;
  color: #fed7aa;
}
/* Repair-form начало работ — ярче в tablet. */
#ewo-app.ewo-mode-tablet .ewo-rep-start-block {
  padding: 16px 20px;
  border-left-width: 4px;
}
#ewo-app.ewo-mode-tablet .ewo-rep-start-label { font-size: 13px; }
#ewo-app.ewo-mode-tablet .ewo-rep-start-value { font-size: 18px; }
/* Длительности в tablet — крупнее цифры. */
#ewo-app.ewo-mode-tablet .ewo-rep-time-narrow {
  font-size: 22px !important;
  max-width: 100px;
}
#ewo-app.ewo-mode-tablet .ewo-rep-time-item label { font-size: 13px; font-weight: 700; }
/* Detail-edit формы (repair/analysis/cms) в tablet — толще borders для visibility. */
#ewo-app.ewo-mode-tablet fieldset.ewo-5w-group {
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  padding: 14px 16px;
}
#ewo-app.ewo-mode-tablet fieldset.ewo-5w-group legend {
  font-size: 15px;
  font-weight: 800;
  color: #fed7aa;
  padding: 0 8px;
}
/* Toast и confirm-modal в tablet — крупнее. */
#ewo-app.ewo-mode-tablet .ewo-modal-message {
  font-size: 17px;
  line-height: 1.5;
}

/* Tablet redesign Phase 6D: автоматическая контрмера — отдельная карточка
   над manual elimination[]/consolidation[]. */
.ewo-cms-auto-card {
  margin: 12px 0 14px;
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(168, 85, 247, 0.04));
  border: 1px solid rgba(168, 85, 247, 0.32);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.10);
}
.ewo-cms-auto-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ewo-cms-auto-icon { font-size: 20px; line-height: 1; }
.ewo-cms-auto-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #d8b4fe;
  font-weight: 700;
}
.ewo-cms-auto-body {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ewo-cms-auto-cause {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  color: var(--ewo-text-secondary);
  font-style: italic;
}
.ewo-cms-auto-arrow {
  font-size: 20px;
  color: #c084fc;
  font-weight: 700;
  flex-shrink: 0;
}
.ewo-cms-auto-action {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.16);
  font-size: 15px;
  color: #f3e8ff;
  font-weight: 700;
}

/* Phase 6E: «Утверждено» badge + кнопка «Утвердить» */
.ewo-cms-approved-badge {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ewo-cms-approve-btn {
  font-size: 13px !important;
  padding: 8px 14px !important;
}

@media (max-width: 600px) {
  .ewo-cms-auto-arrow { transform: rotate(90deg); width: 100%; text-align: center; }
}

.ewo-arch-cms-no {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.ewo-arch-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--ewo-text-secondary);
}
.pk-wal-badge {
  background: var(--ewo-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: auto;
}
.pk-wal-badge.pk-wal-badge-stuck {
  background: #ef4444;
  animation: ewo-wal-pulse 1.5s ease-in-out infinite;
}
@keyframes ewo-wal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Lightbox === */
.ewo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
}
.ewo-lightbox.ewo-lightbox-visible { display: flex; }
.ewo-lightbox-img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
.ewo-lightbox-close,
.ewo-lightbox-prev,
.ewo-lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s;
}
.ewo-lightbox-close { top: 16px; right: 16px; width: 44px; height: 44px; }
.ewo-lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; font-size: 36px; }
.ewo-lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; font-size: 36px; }
.ewo-lightbox-close:hover,
.ewo-lightbox-prev:hover,
.ewo-lightbox-next:hover { background: rgba(255,255,255,0.25); }
.ewo-lightbox-meta {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(15,15,15,0.7);
  padding: 6px 14px;
  border-radius: 14px;
}
.ewo-empty-placeholder .empty-icon { font-size: 48px; opacity: 0.6; }
.ewo-empty-placeholder .empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ewo-text-secondary);
}
.ewo-empty-placeholder .empty-hint {
  font-size: 13px;
  color: var(--ewo-text-muted);
  max-width: 480px;
}

/* === Tablet mode: hide PC-only items === */
#ewo-app.ewo-mode-tablet .ewo-pc-only {
  display: none !important;
}

/* В tablet sidebar превращается в горизонтальный compact topbar (без nav-menu).
   Логика та же — те же ID кнопок (back-to-workshop, switch-subworkshop, switch-user) и
   user-card отображаются, но в одной строке. Контент — plate-стиль на весь экран. */
#ewo-app.ewo-mode-tablet {
  flex-direction: column;
}

#ewo-app.ewo-mode-tablet .ewo-sidebar {
  position: sticky;
  top: 0;
  width: 100%;
  height: auto;
  flex-direction: row;
  align-items: center;
  border-right: none;
  border-bottom: 1px solid var(--ewo-border-1);
  padding: 10px 16px;
  z-index: 50;
  gap: 14px;
  background: var(--ewo-surface-1);
}

#ewo-app.ewo-mode-tablet .ewo-sidebar-header {
  flex: 0 0 auto;
  padding: 0;
  border-bottom: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#ewo-app.ewo-mode-tablet .ewo-sidebar-header h2 { font-size: 16px; margin: 0; }
#ewo-app.ewo-mode-tablet .ewo-sidebar-header .sidebar-back { margin-top: 0; }

/* В tablet навигационное меню (вкладки) полностью убираем — только плитки в content. */
#ewo-app.ewo-mode-tablet .ewo-nav-menu { display: none; }

#ewo-app.ewo-mode-tablet .ewo-sidebar-footer {
  border-top: none;
  margin-left: auto;
  padding: 0;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
#ewo-app.ewo-mode-tablet .ewo-user-card { padding: 0 4px; }
#ewo-app.ewo-mode-tablet .app-dev-credit { display: none; } /* кредит не помещается в строку topbar */
#ewo-app.ewo-mode-tablet .ewo-user-info { max-width: 180px; }
#ewo-app.ewo-mode-tablet .ewo-sidebar-btn {
  padding: 8px 12px;
  font-size: 13px;
}

/* Контент занимает оставшийся экран ВНИЗУ topbar'а — без скролла; wizard сам управляет
   layout'ом + scrollable-fallback если контент не помещается. */
#ewo-app.ewo-mode-tablet .ewo-main {
  margin-left: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* fix flex children с overflow */
  overflow: hidden;
}
#ewo-app.ewo-mode-tablet .ewo-breadcrumb { padding: 8px 16px; margin-bottom: 0; }
#ewo-app.ewo-mode-tablet .ewo-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
/* Dashboard плитки в tablet — небольшой padding */
#ewo-app.ewo-mode-tablet .ewo-content > .ewo-tiles-grid {
  padding: 20px;
  flex: 1;
  align-content: start;
}

/* === Responsive: PC mode на узких экранах (sidebar сжимается) === */
@media (max-width: 768px) {
  /* PC mode на узком экране — sidebar сжимается до 64px (только иконки) */
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar { width: 64px; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-header h2 { font-size: 0; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-header h2::before {
    content: '🚨';
    font-size: 22px;
  }
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-header .ewo-mode-badge,
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-header .sidebar-back { display: none; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-nav-text { display: none; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-nav-item { justify-content: center; padding: 14px 0; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-nav-item.active {
    padding-left: 0; border-left: none; border-right: 3px solid var(--ewo-accent);
  }
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-footer { padding: 10px 6px; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-user-info { display: none; }
  #ewo-app:not(.ewo-mode-tablet) .app-dev-credit { display: none; } /* свёрнутый сайдбар 64px */
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-btn { font-size: 0; padding: 8px; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-sidebar-btn::after { content: '⋯'; font-size: 14px; }
  #ewo-app:not(.ewo-mode-tablet) .ewo-main { margin-left: 64px; padding: 16px 14px; }

  /* Tablet topbar на мобиле — wrap кнопок на новые строки если не помещаются */
  #ewo-app.ewo-mode-tablet .ewo-sidebar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-header h2 { font-size: 14px; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-footer { gap: 6px; }
  #ewo-app.ewo-mode-tablet .ewo-user-info { max-width: 110px; }
  #ewo-app.ewo-mode-tablet .ewo-user-name { font-size: 12px; }
  #ewo-app.ewo-mode-tablet .ewo-user-role { font-size: 10px; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-btn { padding: 6px 10px; font-size: 12px; }
  #ewo-app.ewo-mode-tablet .ewo-main { padding: 14px 12px; }
}

/* ===== Phone (≤640px) — topbar планшета: header был flex-basis:auto (~500px: заголовок
   + 2 бейджа + «← Сменить цех» одной строкой) → кнопка смены цеха уезжала за экран,
   бейдж цеха обрезался. Header ужимается (внутренний flex-wrap уже есть в базе),
   заголовок → иконка (паттерн PC-сайдбара выше), бейджи с ellipsis (имена цехов
   конфигурируемы до 40 симв). Блок идёт ПОСЛЕ ≤768 — перекрывает его h2 14px. ===== */
@media (max-width: 640px) {
  #ewo-app.ewo-mode-tablet .ewo-sidebar-header { flex: 0 1 auto; min-width: 0; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-header h2 { font-size: 0; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-header h2::before { content: '🚨'; font-size: 22px; }
  #ewo-app.ewo-mode-tablet .ewo-sidebar-header .ewo-mode-badge {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  .ewo-mode-tile,
  #ws-ewo,
  .ewo-nav-item,
  .ewo-sidebar-btn,
  #ewo-mode-back, #ewo-sub-back {
    transition: none !important;
    transform: none !important;
  }
}

/* ============================================================
   E11: Stats dashboard
   ============================================================ */

/* === Filter bar (pills + collapsible custom dates + active badge) === */
.ewo-stats-filterbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ewo-stats-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ewo-stats-filter-label {
  font-size: 11px;
  color: var(--ewo-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  min-width: 56px;
}
.ewo-stats-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ewo-stats-pill {
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--ewo-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 100ms ease;
}
.ewo-stats-pill:hover {
  background: rgba(255,255,255,0.07);
  color: var(--ewo-text-strong);
}
.ewo-stats-pill.active {
  background: var(--ewo-accent);
  border-color: var(--ewo-accent);
  color: #fff;
  font-weight: 600;
}
.ewo-stats-pill.active:hover { background: var(--ewo-accent-light); }
.ewo-stats-pill:focus-visible {
  outline: 2px solid var(--ewo-accent-light);
  outline-offset: 2px;
}
.ewo-stats-clear-btn {
  margin-left: auto;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--ewo-text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.ewo-stats-clear-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239,68,68,0.05);
}
.ewo-stats-custom-dates {
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.06);
}
.ewo-stats-date {
  width: 160px;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

/* === Period navigator: ◀ Apr 2026 ▶ + ⌂ Now === */
.ewo-stats-navigator {
  padding: 6px 0;
  gap: 6px;
}
.ewo-stats-nav-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--ewo-text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.ewo-stats-nav-btn:hover {
  background: var(--ewo-accent);
  border-color: var(--ewo-accent);
  color: #fff;
}
.ewo-stats-nav-btn:focus-visible {
  outline: 2px solid var(--ewo-accent-light);
  outline-offset: 2px;
}
.ewo-stats-nav-label {
  min-width: 140px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ewo-text-strong);
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}
.ewo-stats-nav-today {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--ewo-text-muted);
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
  transition: color 120ms ease, border-color 120ms ease;
}
.ewo-stats-nav-today:hover {
  color: var(--ewo-accent-light);
  border-color: var(--ewo-accent);
}
@media (prefers-reduced-motion: reduce) {
  .ewo-stats-nav-btn, .ewo-stats-nav-today { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ewo-stats-pill, .ewo-stats-clear-btn { transition: none; }
}

/* === Active filter badge (показывает текущий выбор) === */
.ewo-stats-active-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(245,158,11,0.08), rgba(245,158,11,0));
  border-left: 3px solid var(--ewo-accent);
  border-radius: 0 8px 8px 0;
  margin-bottom: 14px;
}
.ewo-stats-active-badge-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ewo-text-strong);
}
.ewo-stats-active-badge-meta {
  font-size: 12px;
  color: var(--ewo-text-secondary);
}
.ewo-stats-active-badge-meta b { color: var(--ewo-text-strong); }

/* === KPI: 2 группы (counts + timings) === */
.ewo-stats-kpi-section { padding: 16px 18px; }

/* Counts: 5 mini cards (auto-fit, минимум 140px) */
.ewo-stats-kpi-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ewo-stats-kpi-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 3px solid var(--kpi-accent, var(--ewo-accent));
  border-radius: 10px;
  transition: background 120ms ease, transform 120ms ease;
}
.ewo-stats-kpi-mini:hover {
  background: rgba(255,255,255,0.05);
}
.ewo-stats-kpi-mini-icon {
  font-size: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.ewo-stats-kpi-mini-body { min-width: 0; }
.ewo-stats-kpi-mini-label {
  font-size: 11px;
  color: var(--ewo-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ewo-stats-kpi-mini-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ewo-stats-kpi-mini-pct {
  font-size: 12px;
  color: var(--kpi-accent, var(--ewo-text-muted));
  font-weight: 600;
}

/* Timings: 3 large cards */
.ewo-stats-kpi-timings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
@media (max-width: 900px) {
  .ewo-stats-kpi-timings { grid-template-columns: 1fr; }
}
/* Леджер (29.05): flex-колонка — hero-среднее сверху, мини-леджер прижат к низу
   (margin-top:auto) → строки Медиана/Σ выровнены по всем 3 плиткам независимо от
   переноса подписей. Все плитки имеют идентичную структуру → равная высота. */
.ewo-stats-kpi-large {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 3px solid var(--kpi-accent, var(--ewo-accent));
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.ewo-stats-kpi-large-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.ewo-stats-kpi-large-headtext { min-width: 0; flex: 1; }
.ewo-stats-kpi-large-icon {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.ewo-stats-kpi-large-label {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  line-height: 1.3;
}
.ewo-stats-kpi-large-hint {
  font-size: 11px;
  color: var(--ewo-text-muted);
  font-style: italic;
}
/* Пилюля «N EWO» справа в шапке (размер выборки) */
.ewo-stats-kpi-large-samples {
  flex-shrink: 0;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--kpi-accent, var(--ewo-text-secondary));
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ewo-stats-kpi-large-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ewo-text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
/* Мини-леджер: Медиана / Σ Совокупно — общая правая колонка значений, прижат к низу */
.ewo-stats-kpi-large-ledger {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ewo-stats-kpi-ledger-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--ewo-text-muted);
}
.ewo-stats-kpi-ledger-row .lk { white-space: nowrap; }
.ewo-stats-kpi-ledger-row .lv {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ewo-text-secondary);
}
.ewo-stats-kpi-ledger-row.is-total .lk .sigma {
  font-weight: 700;
  color: var(--kpi-accent, var(--ewo-accent));
  font-size: 13px;
  margin-right: 2px;
}
.ewo-stats-kpi-ledger-row.is-total .lv {
  color: var(--kpi-accent, var(--ewo-accent));
  font-size: 14px;
}
/* Σ в мини-плитках фаз ремонта (29.05) — зеркало большого леджера */
.ewo-stats-kpi-mini-vsub {
  font-size: 10px;
  font-weight: 400;
  color: var(--ewo-text-muted);
  text-transform: none;
  letter-spacing: 0;
}
.ewo-stats-kpi-mini-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.1);
  font-size: 11px;
  color: var(--ewo-text-muted);
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.ewo-stats-kpi-mini-total .sigma {
  font-weight: 700;
  color: var(--kpi-accent, var(--ewo-accent));
  font-size: 12px;
}
.ewo-stats-kpi-mini-total b {
  margin-left: auto;
  font-weight: 700;
  color: var(--kpi-accent, var(--ewo-accent));
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* === Section + bars === */
.ewo-stats-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
}
.ewo-stats-section h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--ewo-text-strong);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.ewo-stats-empty {
  font-size: 13px;
  color: var(--ewo-text-muted);
  padding: 8px 4px;
  font-style: italic;
}
.ewo-stats-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 1100px) {
  .ewo-stats-grid-2 { grid-template-columns: 1fr; }
}
.ewo-stats-grid-2 .ewo-stats-section { margin-top: 0; }
.ewo-stats-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* C1 (28.05): разбивка ремонта по фазам — мини-плитки под «Средний ремонт» */
.ewo-stats-repair-phases { margin-top: 14px; }
.ewo-stats-repair-phases-title {
  font-size: 12px; color: var(--ewo-text-muted); text-transform: uppercase;
  letter-spacing: 0.4px; font-weight: 700; margin-bottom: 8px;
}
/* B2 (28.05): блок отклонённых EWO — красный акцент, визуально отдельно */
.ewo-stats-rejected-section {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
}
.ewo-stats-rejected-section h3 { color: #fca5a5; }
/* Отклонённые (29.05): 3 центрированные карточки — по аналогии с timing-леджером */
.ewo-stats-rejected-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 720px) { .ewo-stats-rejected-kpi { grid-template-columns: 1fr; } }
.ewo-stats-rejected-stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px;
  padding: 14px 16px; border-radius: 10px;
  background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2);
  border-top: 3px solid #ef4444;
}
.ewo-stats-rejected-stat .rico { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.ewo-stats-rejected-stat .num { font-size: 24px; font-weight: 700; color: var(--ewo-text-strong); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ewo-stats-rejected-stat .lbl { font-size: 12px; color: var(--ewo-text-muted); }
/* Σ-стат (29.05): акцент как у леджера */
.ewo-stats-rejected-stat.is-total { background: rgba(239,68,68,0.14); border-color: rgba(239,68,68,0.35); }
.ewo-stats-rejected-stat.is-total .num { color: #fca5a5; }
.ewo-stats-rejected-stat.is-total .rico { color: #fca5a5; font-weight: 700; }
/* Фазы ремонта: 3 строки в плитке → икона к верху */
.ewo-stats-kpi-mini-phase { align-items: flex-start; }
.ewo-stats-rejected-sub h4 {
  margin: 0 0 8px 0; font-size: 12px; color: var(--ewo-text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600;
}
.ewo-stats-rejected-section .ewo-stats-grid-2 { margin-top: 4px; }
.ewo-stats-empty-hint { font-size: 12px; color: var(--ewo-text-muted); font-style: italic; padding: 4px; }
.ewo-stats-bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 30%) 1fr minmax(140px, auto);
  gap: 12px;
  align-items: center;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 120ms ease;
}
.ewo-stats-bar-row:hover {
  background: rgba(255,255,255,0.025);
}
.ewo-stats-bar-row:hover .ewo-stats-bar-fill {
  filter: brightness(1.15);
}
.ewo-stats-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ewo-text-secondary);
  min-width: 0;
}
.ewo-stats-bar-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}
.ewo-stats-bar-label-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ewo-stats-bar-track {
  position: relative;
  height: 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.ewo-stats-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 320ms cubic-bezier(0.4, 0, 0.2, 1), filter 120ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
@media (prefers-reduced-motion: reduce) {
  .ewo-stats-bar-fill { transition: none; }
  .ewo-stats-bar-row { transition: none; }
}
.ewo-stats-bar-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ewo-text-strong);
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}

/* ============================================================
   E12: Settings dashboard
   ============================================================ */
.ewo-settings { display: flex; flex-direction: column; gap: 16px; }
.ewo-settings-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px 18px;
}
.ewo-settings-section h3 {
  margin: 0 0 14px 0;
  font-size: 14px;
  color: var(--ewo-text-strong);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
}
.ewo-settings-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ewo-settings-section-head h3 { margin: 0; }
.ewo-settings-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.ewo-settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ewo-settings-field label {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  font-weight: 600;
}
.ewo-settings-field-hint {
  font-size: 11px;
  color: var(--ewo-text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.ewo-settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.ewo-settings-status {
  font-size: 12px;
  color: var(--ewo-text-muted);
}
.ewo-settings-mute {
  color: var(--ewo-text-muted);
  font-weight: normal;
}
.ewo-settings-collision {
  font-size: 12px;
  color: #f59e0b;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
}
.ewo-settings-checkboxes {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.ewo-settings-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ewo-text-secondary);
}
.ewo-settings-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.ewo-settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ewo-settings-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--ewo-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ewo-settings-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.ewo-settings-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.ewo-settings-empty {
  text-align: center;
  font-style: italic;
  color: var(--ewo-text-muted);
  padding: 16px !important;
}
.ewo-btn-tbl {
  padding: 6px 10px !important;
  font-size: 13px !important;
  margin-right: 4px;
}
.ewo-settings-auto-backup {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.ewo-settings-auto-backup legend {
  padding: 0 8px;
  font-size: 12px;
  color: var(--ewo-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.ewo-settings-danger {
  border-color: rgba(239,68,68,0.2);
  background: rgba(239,68,68,0.04);
}
.ewo-settings-danger h3 { color: #fca5a5; }
.ewo-settings-danger-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
}
.ewo-settings-danger-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ewo-text-strong);
}

/* === Должности (positions CRUD) === */
.ewo-positions-list {
  list-style: none;
  margin: 0 0 12px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ewo-position-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ewo-text-strong);
}
.ewo-position-name { font-weight: 500; }
.ewo-position-row .ewo-btn-tbl {
  padding: 2px 8px !important;
  margin: 0 !important;
  font-size: 12px !important;
}
.ewo-position-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.ewo-position-add-row .ewo-input {
  flex: 1;
  max-width: 320px;
}

/* === Структура lines/machines: 2-колоночный grid === */
/* === Структура линий и машин === */
.ewo-structure-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.ewo-structure-section-head h3 { margin: 0; }
.ewo-structure-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ewo-structure-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--ewo-bg-soft);
  border: 1px solid var(--ewo-border-soft);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ewo-text-primary);
  font-variant-numeric: tabular-nums;
}
.ewo-structure-summary-chip b { color: var(--ewo-text-strong); }
.ewo-structure-summary-emoji { font-size: 14px; }

.ewo-structure-section .ewo-settings-field-hint code {
  background: rgba(0,0,0,0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ewo-accent-light);
}

.ewo-structure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px) {
  .ewo-structure-grid { grid-template-columns: 1fr; }
}
.ewo-structure-col {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 3px solid var(--ewo-accent);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.ewo-structure-col-mixing { border-top-color: #f97316; }
.ewo-structure-col-packing { border-top-color: #8b5cf6; }
.ewo-structure-col-other { border-top-color: #94a3b8; }

.ewo-structure-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ewo-structure-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ewo-text-strong);
}
.ewo-structure-col-icon {
  font-size: 22px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.ewo-structure-col-counters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ewo-structure-counter-pill {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  background: rgba(255,255,255,0.04);
  padding: 3px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ewo-structure-col-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ewo-structure-action {
  font-size: 13px;
  padding: 6px 12px;
  white-space: nowrap;
}
.ewo-structure-lines-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ewo-structure-empty-card {
  text-align: center;
  padding: 28px 12px;
  background: rgba(0,0,0,0.15);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
}
.ewo-structure-empty-icon {
  font-size: 32px;
  opacity: 0.55;
  margin-bottom: 8px;
}
.ewo-structure-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ewo-text-secondary);
}
.ewo-structure-empty-hint {
  font-size: 12px;
  color: var(--ewo-text-muted);
  margin-top: 6px;
}

/* Линия как карточка-collapsible */
.ewo-structure-line {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 120ms ease;
}
.ewo-structure-line:hover { border-color: rgba(255,255,255,0.14); }
.ewo-structure-line[open] { border-color: var(--ewo-border-soft); }
.ewo-structure-line summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 100ms ease;
}
.ewo-structure-line summary::-webkit-details-marker { display: none; }
.ewo-structure-line-chev {
  font-size: 12px;
  color: var(--ewo-text-muted);
  transition: transform 150ms ease;
  flex-shrink: 0;
  display: inline-block;
}
.ewo-structure-line[open] .ewo-structure-line-chev { transform: rotate(90deg); }
.ewo-structure-line summary:hover { background: rgba(255,255,255,0.03); }
.ewo-structure-line-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ewo-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.ewo-structure-line-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ewo-accent-light);
  background: var(--ewo-bg-soft);
  border: 1px solid var(--ewo-border-soft);
  padding: 2px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 22px;
  text-align: center;
}
.ewo-structure-machines {
  list-style: none;
  margin: 0;
  padding: 4px 12px 10px 30px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
}
.ewo-structure-machines li {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ewo-structure-machine-dot {
  color: var(--ewo-accent);
  font-size: 8px;
  opacity: 0.7;
  flex-shrink: 0;
}
.ewo-structure-line-empty {
  padding: 4px 12px 10px 30px;
  color: var(--ewo-text-muted);
  font-size: 12px;
  font-style: italic;
}
@media (prefers-reduced-motion: reduce) {
  .ewo-structure-line,
  .ewo-structure-line summary,
  .ewo-structure-line-chev { transition: none; }
}

/* === XLSX import modal === */
.ewo-xlsx-import-modal { max-width: 640px; }
.ewo-xlsx-summary {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.7;
}
.ewo-xlsx-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ewo-xlsx-summary-row b { color: var(--ewo-text-strong); }
.ewo-xlsx-summary-row code {
  background: rgba(0,0,0,0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ewo-accent-light);
}
.ewo-xlsx-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ewo-xlsx-pill-new { background: rgba(16,185,129,0.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.35); }
.ewo-xlsx-pill-dup { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.35); }
.ewo-xlsx-warnings {
  font-size: 12px;
  color: #fcd34d;
  margin-top: 6px;
}

.ewo-xlsx-modes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.ewo-xlsx-mode {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.ewo-xlsx-mode:hover { border-color: var(--ewo-border-soft); background: var(--ewo-bg-soft); }
.ewo-xlsx-mode:has(input:checked) {
  border-color: var(--ewo-border-soft2);
  background: var(--ewo-bg-soft2);
}
.ewo-xlsx-mode input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--ewo-accent);
  cursor: pointer;
}
.ewo-xlsx-mode-text { flex: 1; min-width: 0; }
.ewo-xlsx-mode-title { font-size: 14px; font-weight: 600; color: var(--ewo-text-primary); margin-bottom: 3px; }
.ewo-xlsx-mode-hint { font-size: 12px; color: var(--ewo-text-muted); line-height: 1.45; }
.ewo-xlsx-mode-hint-danger { color: #fca5a5; }

.ewo-xlsx-preview {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.15);
}
.ewo-xlsx-preview > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ewo-text-secondary);
  user-select: none;
}
.ewo-xlsx-preview-list {
  list-style: none;
  margin: 8px 0 4px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 35vh;
  overflow-y: auto;
}
.ewo-xlsx-preview-list li {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  background: rgba(255,255,255,0.02);
}
.ewo-xlsx-preview-new { border-left: 2px solid #10b981; }
.ewo-xlsx-preview-dup { border-left: 2px solid #f59e0b; }
.ewo-xlsx-preview-meta {
  margin-left: 8px;
  font-size: 11px;
  color: var(--ewo-text-muted);
  font-variant-numeric: tabular-nums;
}
.ewo-xlsx-preview-machines {
  margin-top: 4px;
  padding-left: 14px;
  font-size: 11.5px;
  color: var(--ewo-text-muted);
  line-height: 1.4;
}
@media (prefers-reduced-motion: reduce) {
  .ewo-xlsx-mode { transition: none; }
}

/* === Backup with-photos badge === */
.ewo-bk-photo-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  background: var(--ewo-bg-soft2);
  border: 1px solid var(--ewo-border-soft);
  border-radius: 999px;
  color: var(--ewo-accent-light);
  vertical-align: middle;
}

/* === E13.2: Stats cascade-фильтр === */
.ewo-stats-cascade-select { min-width: 160px; max-width: 220px; }
.ewo-stats-cascade-select:disabled { opacity: 0.55; cursor: not-allowed; }

/* === E13.3: Time analytics === */
.ewo-stats-section-meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--ewo-text-muted);
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
.ewo-stats-section-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ewo-text-muted);
  font-style: italic;
}
.ewo-stats-cum-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}
.ewo-stats-cum-badge.ewo-stats-cum-hot {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
/* Pareto-row layout: имя | bar | значение | cum-badge — flex с фиксированным badge справа */
.ewo-stats-bars .ewo-stats-bar-row:has(.ewo-stats-cum-badge) {
  position: relative;
}

/* === E13.1: Audit log viewer === */
.ewo-audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ewo-audit-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ewo-audit-meta b { color: var(--ewo-text-strong); }
.ewo-audit-meta-hint { font-size: 11.5px; color: var(--ewo-text-muted); }

.ewo-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ewo-audit-item {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid var(--ewo-accent);
  border-radius: 8px;
  transition: background 0.12s;
}
.ewo-audit-item:hover { background: rgba(255,255,255,0.04); }
.ewo-audit-item-selected { background: rgba(239, 68, 68, 0.08) !important; border-color: rgba(239, 68, 68, 0.35) !important; }
.ewo-audit-row-cb { margin-top: 4px; flex-shrink: 0; cursor: pointer; accent-color: #ef4444; }

/* Audit pagination */
.ewo-audit-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  flex-wrap: wrap;
}
.ewo-audit-page-label {
  font-size: 12.5px;
  color: var(--ewo-text-secondary);
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}
.ewo-audit-page-label b { color: var(--ewo-text-strong); }
.ewo-audit-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 14px;
  color: #fff;
}
.ewo-audit-item-body {
  flex: 1;
  min-width: 0;
}
.ewo-audit-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.ewo-audit-item-action {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ewo-text-strong);
}
.ewo-audit-item-time {
  font-size: 11.5px;
  color: var(--ewo-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ewo-audit-item-user {
  font-size: 12px;
  color: var(--ewo-text-secondary);
  margin-top: 2px;
}
.ewo-audit-item-details {
  font-size: 12.5px;
  color: var(--ewo-text-primary);
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(0,0,0,0.18);
  border-radius: 4px;
  word-break: break-word;
}
@media (prefers-reduced-motion: reduce) {
  .ewo-audit-item { transition: none; }
}

/* === Backup interval value + unit === */
.ewo-bk-interval-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.ewo-bk-interval-value { width: 80px; text-align: center; }
.ewo-bk-interval-unit { width: 110px; }
.ewo-bk-interval-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.ewo-bk-preset-pill {
  padding: 4px 12px;
  font-size: 12px;
  font-family: inherit;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: var(--ewo-text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.ewo-bk-preset-pill:hover {
  border-color: var(--ewo-border-soft);
  background: var(--ewo-bg-soft);
  color: var(--ewo-text-primary);
}
.ewo-bk-preset-pill.ewo-bk-preset-active {
  border-color: var(--ewo-border-soft2);
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent-light);
}
@media (prefers-reduced-motion: reduce) {
  .ewo-bk-preset-pill { transition: none; }
}

/* === E11: Employee table === */
.ewo-stats-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.ewo-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ewo-stats-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--ewo-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ewo-stats-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-variant-numeric: tabular-nums;
}
.ewo-stats-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
/* AUDIT_17 M68 (Sprint M3): удалённые users в byEmployee — приглушённый ряд + cursor:help. */
.ewo-stats-table tbody tr.ewo-emp-inactive {
  opacity: 0.55;
  cursor: help;
}
.ewo-stats-table tbody tr.ewo-emp-inactive:hover {
  opacity: 0.75;
  background: rgba(255,255,255,0.02);
}

/* === 🔢 Reset counter card (admin only, в Settings → Конфиг) === */
.ewo-counter-card {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(249, 115, 22, 0.04);
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-left: 3px solid var(--ewo-accent);
  border-radius: 8px;
}
.ewo-counter-card h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ewo-accent-light);
}
.ewo-counter-current {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
}
.ewo-counter-label { color: var(--ewo-text-secondary); }
.ewo-counter-value, .ewo-counter-next {
  background: rgba(0,0,0,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 12.5px;
  color: var(--ewo-accent-light);
}
.ewo-counter-next {
  font-weight: 700;
  background: var(--ewo-bg-soft2);
  color: var(--ewo-accent);
}
.ewo-counter-arrow {
  color: var(--ewo-text-muted);
  font-size: 14px;
}
.ewo-counter-info {
  font-size: 12.5px;
  color: var(--ewo-text-primary);
  background: rgba(59, 130, 246, 0.08);
  border-left: 2px solid #3b82f6;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  line-height: 1.5;
}
.ewo-counter-info code {
  background: rgba(0,0,0,0.3);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--ewo-accent-light);
}
.ewo-counter-info-muted {
  font-size: 12px;
  color: var(--ewo-text-muted);
  font-style: italic;
  margin-bottom: 4px;
}
.ewo-counter-hint { color: var(--ewo-text-muted); font-size: 11px; font-weight: 400; }
.ewo-counter-preview {
  margin: 8px 0;
  font-size: 12.5px;
}
.ewo-counter-preview-row {
  padding: 6px 10px;
  background: rgba(16, 185, 129, 0.08);
  border-left: 2px solid #10b981;
  border-radius: 4px;
}
.ewo-counter-preview-row code {
  background: rgba(0,0,0,0.3);
  padding: 1px 7px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  color: #6ee7b7;
}
.ewo-counter-warn {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.45;
}

/* === ⚠️ Опасная зона (admin only) === */
.ewo-danger-zone {
  border-color: rgba(239, 68, 68, 0.35) !important;
  background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
}
.ewo-danger-zone h3 { color: #fca5a5; }
.ewo-danger-warning {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-left: 3px solid #ef4444;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: var(--ewo-text-primary);
  font-size: 13.5px;
  line-height: 1.55;
}
.ewo-danger-warning-line { margin-bottom: 6px; }
.ewo-danger-warning-line:last-child { margin-bottom: 0; }
.ewo-danger-warning code {
  background: rgba(0,0,0,0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #fb923c;
}
.ewo-btn-danger {
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: #ef4444;
  color: #fff;
  border: 1px solid #ef4444;
  font-weight: 600;
}
.ewo-btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.ewo-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; background: #6b7280; border-color: #6b7280; }
.ewo-btn-danger:focus-visible {
  outline: 2px solid #fca5a5;
  outline-offset: 2px;
}

/* === Danger reset modal === */
.ewo-danger-modal { max-width: 640px; }
.ewo-danger-modal-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: var(--ewo-text-primary);
  font-size: 13px;
  line-height: 1.5;
}
.ewo-danger-modal-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ewo-danger-modal-shortcuts .ewo-btn-secondary {
  padding: 6px 12px;
  font-size: 12.5px;
}
.ewo-danger-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}
.ewo-danger-target-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ewo-danger-target-row:hover {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}
.ewo-danger-target-row:has(.ewo-danger-target-cb:checked) {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.08);
}
.ewo-danger-target-cb {
  margin-top: 3px;
  width: 16px; height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #ef4444;
}
.ewo-danger-target-text { flex: 1; min-width: 0; }
.ewo-danger-target-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ewo-text-primary);
  margin-bottom: 2px;
}
.ewo-danger-target-hint {
  font-size: 12px;
  color: var(--ewo-text-muted);
  line-height: 1.45;
}
@media (prefers-reduced-motion: reduce) {
  .ewo-btn-danger, .ewo-danger-target-row { transition: none; }
}
