/**
 * components.css — Owner-page, COO cockpit, Site page и общие UI-компоненты (Этапы 1–3)
 * Опирается на design tokens v103 (--bg, --card, --border, --pos, --neg, --warn, --accent)
 */

/* ── Owner / COO / Site mode: скрыть legacy v103 ──────────────────────── */
body.owner-role-active .toolbar,
body.owner-role-active .nav-btns,
body.coo-role-active .toolbar,
body.coo-role-active .nav-btns,
body.site-role-active .toolbar,
body.site-role-active .nav-btns,
body.role-stub-active .toolbar,
body.role-stub-active .nav-btns {
  display: none !important;
}

body.owner-role-active .main > .page:not(#page-role-owner) {
  display: none !important;
}

body.owner-role-active #page-role-owner {
  display: block !important;
}

body.coo-role-active .main > .page:not(#page-role-coo) {
  display: none !important;
}

body.coo-role-active #page-role-coo {
  display: block !important;
}

body.site-role-active .main > .page:not(#page-role-site) {
  display: none !important;
}

body.site-role-active #page-role-site {
  display: block !important;
}

/* ── Header: переключатель роли (router.js) ───────────────────────────── */
.app-role-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
}

.app-role-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.app-role-switcher {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.app-role-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  transition: var(--transition, 0.18s ease);
  white-space: nowrap;
  min-height: 26px;
  flex-shrink: 0;
}

.app-role-btn:hover {
  color: var(--text);
  background: var(--card2);
}

.app-role-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Заглушки COO / Site (router.js) ──────────────────────────────────── */
.role-stub-page {
  padding: 24px 0;
}

.role-stub {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px 24px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius, 10px);
}

.role-stub-icon {
  font-size: 28px;
  opacity: 0.5;
  margin-bottom: 12px;
}

.role-stub-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
}

.role-stub-subtitle {
  font-size: 12px;
  color: var(--warn);
  font-weight: 600;
  margin: 0 0 14px;
}

.role-stub-text,
.role-stub-hint {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin: 0 0 10px;
}

@media (max-width: 768px) {
  .hdr-top {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 6px;
  }

  .hdr-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-actions {
    flex: 0 0 auto;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .app-role-switcher-wrap {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .app-role-switcher-wrap::-webkit-scrollbar {
    display: none;
  }

  .app-role-switcher {
    flex-wrap: nowrap;
    min-width: min-content;
  }

  .app-role-btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* ── Owner page layout ─────────────────────────────────────────────────── */
.owner-role-page {
  padding-bottom: 24px;
}

.owner-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.owner-header-main {
  min-width: 0;
  flex: 1 1 200px;
}

.owner-title {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

.owner-subtitle {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

.owner-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.owner-ctrl-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.owner-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.owner-scope-btn,
.owner-role-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  transition: var(--transition, 0.18s ease);
  white-space: nowrap;
  min-height: 28px;
}

.owner-scope-btn:hover,
.owner-role-btn:hover {
  color: var(--text);
  background: var(--card2);
}

.owner-scope-btn.active,
.owner-role-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.owner-fresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text2);
}

.owner-fresh-badge.ok { border-color: rgba(74, 222, 128, 0.35); color: var(--pos); }
.owner-fresh-badge.warn { border-color: rgba(251, 146, 60, 0.35); color: var(--warn); }
.owner-fresh-badge.err { border-color: rgba(248, 113, 113, 0.35); color: var(--neg); }

/* ── Executive layer ───────────────────────────────────────────────────── */
.owner-executive {
  margin-bottom: 20px;
}

.owner-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.owner-kpi-card {
  background: var(--card);
  border-radius: var(--radius, 10px);
  padding: 14px 16px;
  border: 1px solid var(--border);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.owner-kpi-card.status-green { border-color: rgba(74, 222, 128, 0.35); }
.owner-kpi-card.status-yellow { border-color: rgba(251, 146, 60, 0.4); }
.owner-kpi-card.status-red { border-color: rgba(248, 113, 113, 0.45); }
.owner-kpi-card.status-gray { border-color: var(--border); opacity: 0.72; }

.owner-kpi-label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.owner-kpi-value {
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.owner-kpi-sub {
  font-size: 11px;
  color: var(--text2);
}

.owner-kpi-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.owner-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.owner-status-dot.green { background: var(--pos); }
.owner-status-dot.yellow { background: var(--warn); }
.owner-status-dot.red { background: var(--neg); }
.owner-status-dot.gray { background: var(--text2); opacity: 0.5; }

.owner-kpi-delta {
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.owner-kpi-delta.up { color: var(--pos); }
.owner-kpi-delta.down { color: var(--neg); }
.owner-kpi-delta.flat { color: var(--text2); }

.owner-kpi-interp {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.35;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.owner-kpi-unavail {
  font-size: 12px;
  color: var(--text2);
  font-style: italic;
}

/* Skeleton */
.owner-kpi-card.is-loading .owner-kpi-value,
.owner-kpi-card.is-loading .owner-kpi-sub,
.owner-kpi-card.is-loading .owner-kpi-delta {
  background: var(--border);
  border-radius: 4px;
  color: transparent !important;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
  min-height: 18px;
}

/* Executive row: brief + issues + actions */
.owner-exec-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 10px;
}

.owner-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  min-width: 0;
}

.owner-panel h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  margin: 0 0 10px;
}

/* Owner brief */
.owner-brief-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

.owner-brief-status.stable {
  border-color: rgba(74, 222, 128, 0.35);
  color: var(--pos);
  background: color-mix(in oklab, var(--pos) 10%, var(--card));
}

.owner-brief-status.watch {
  border-color: rgba(251, 146, 60, 0.35);
  color: var(--warn);
  background: color-mix(in oklab, var(--warn) 10%, var(--card));
}

.owner-brief-status.critical {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--neg);
  background: color-mix(in oklab, var(--neg) 10%, var(--card));
}

.owner-brief-list {
  display: grid;
  gap: 7px;
}

.owner-brief-item {
  font-size: 12px;
  line-height: 1.45;
  padding-left: 12px;
  position: relative;
}

.owner-brief-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Top issues */
.owner-issue {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  align-items: start;
}

.owner-issue:first-child {
  border-top: none;
  padding-top: 0;
}

.owner-issue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: color-mix(in oklab, var(--neg) 15%, var(--card));
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--neg);
}

.owner-issue-main {
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 600;
}

.owner-issue-sub {
  font-size: 10px;
  color: var(--text2);
  margin-top: 3px;
  line-height: 1.35;
}

/* Recommended actions */
.owner-action {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--card2);
  border-left: 3px solid var(--border);
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.owner-action:last-child { margin-bottom: 0; }

.owner-action.status-red { border-left-color: var(--neg); }
.owner-action.status-yellow { border-left-color: var(--warn); }
.owner-action.status-green { border-left-color: var(--pos); }

.owner-action-icon { flex-shrink: 0; font-size: 13px; }

.owner-empty {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

/* ── Diagnostic layer ──────────────────────────────────────────────────── */
.owner-diagnostic {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.owner-diag-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.owner-diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.owner-diag-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 14px;
  min-width: 0;
}

.owner-diag-card h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.owner-diag-sub {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 10px;
}

/* Site comparison */
.owner-site-table-wrap {
  overflow-x: auto;
}

.owner-site-table {
  width: 100%;
  border-collapse: collapse;
}

.owner-site-table th,
.owner-site-table td {
  padding: 8px 10px;
  text-align: right;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.owner-site-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.owner-site-table th:first-child,
.owner-site-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.owner-site-table tr:last-child td {
  border-bottom: none;
}

.owner-site-table .site-best { color: var(--pos); }
.owner-site-table .site-worst { color: var(--neg); }

/* Cost bars (reuse v103 pattern) */
.owner-cost-bars .cost-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.owner-cost-bars .cost-bar-label {
  font-size: 11px;
  color: var(--text2);
  width: 80px;
}

.owner-cost-bars .cost-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.owner-cost-bars .cost-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.owner-cost-bars .cost-bar-val {
  font-size: 11px;
  font-weight: 600;
  width: 44px;
  text-align: right;
}

/* Chart wrap */
.owner-chart-wrap {
  position: relative;
  height: 200px;
  min-height: 120px;
}

/* Gray stub cards */
.owner-stub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.owner-stub-card {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  opacity: 0.65;
  min-width: 0;
}

.owner-stub-card.large {
  grid-column: span 1;
  min-height: 100px;
}

.owner-stub-icon {
  font-size: 18px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.owner-stub-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.owner-stub-text {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

/* ── Mobile: executive first, diagnostic below ─────────────────────────── */
@media (max-width: 900px) {
  .owner-exec-row {
    grid-template-columns: 1fr;
  }

  .owner-diag-grid {
    grid-template-columns: 1fr;
  }

  .owner-header-controls {
    width: 100%;
  }

  .owner-ctrl-group {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .owner-kpi-value {
    font-size: 20px;
  }

  .owner-panel {
    padding: 10px 12px;
  }

  .owner-chart-wrap {
    height: 160px;
  }
}

@media (min-width: 901px) {
  /* Desktop: 3 KPI + issues visible without much scroll */
  .owner-executive {
    min-height: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COO cockpit (Этап 2, render/coo.js)
   ═══════════════════════════════════════════════════════════════════════════ */

.coo-role-page {
  padding-bottom: 24px;
}

.coo-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.coo-header-main {
  min-width: 0;
  flex: 1 1 200px;
}

.coo-title {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

.coo-subtitle {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

.coo-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.coo-ctrl-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.coo-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.coo-scope-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text2);
  transition: var(--transition, 0.18s ease);
  white-space: nowrap;
  min-height: 28px;
}

.coo-scope-btn:hover {
  color: var(--text);
  background: var(--card2);
}

.coo-scope-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.coo-period-select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  margin-left: 4px;
}

.coo-header-controls .coo-period-toolbar select,
.coo-header-controls .coo-period-toolbar input {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 11px;
  padding: 2px 5px;
}

.coo-fresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text2);
}

.coo-fresh-badge.ok { border-color: rgba(74, 222, 128, 0.35); color: var(--pos); }
.coo-fresh-badge.warn { border-color: rgba(251, 146, 60, 0.35); color: var(--warn); }
.coo-fresh-badge.err { border-color: rgba(248, 113, 113, 0.35); color: var(--neg); }

/* Executive KPI */
.coo-executive {
  margin-bottom: 20px;
}

.coo-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.coo-kpi-card {
  background: var(--card);
  border-radius: var(--radius, 10px);
  padding: 14px 16px;
  border: 1px solid var(--border);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
}

.coo-kpi-card.status-green { border-color: rgba(74, 222, 128, 0.35); }
.coo-kpi-card.status-yellow { border-color: rgba(251, 146, 60, 0.4); }
.coo-kpi-card.status-red { border-color: rgba(248, 113, 113, 0.45); }
.coo-kpi-card.status-gray { border-color: var(--border); opacity: 0.72; }

.coo-kpi-label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.coo-kpi-value {
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.coo-kpi-sub {
  font-size: 11px;
  color: var(--text2);
}

.coo-kpi-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
}

.coo-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.coo-status-dot.green { background: var(--pos); }
.coo-status-dot.yellow { background: var(--warn); }
.coo-status-dot.red { background: var(--neg); }
.coo-status-dot.gray { background: var(--text2); opacity: 0.5; }

.coo-kpi-delta {
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.coo-kpi-delta.up { color: var(--pos); }
.coo-kpi-delta.down { color: var(--neg); }
.coo-kpi-delta.flat { color: var(--text2); }

.coo-kpi-interp {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.coo-kpi-unavail {
  font-size: 12px;
  color: var(--text2);
  font-style: italic;
}

.coo-kpi-card.is-loading .coo-kpi-value,
.coo-kpi-card.is-loading .coo-kpi-delta {
  background: var(--border);
  border-radius: 4px;
  color: transparent !important;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
  min-height: 18px;
}

/* Executive row: site map + action list */
.coo-exec-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.coo-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  min-width: 0;
}

.coo-panel h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  margin: 0 0 6px;
}

.coo-diag-sub {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 10px;
}

.coo-empty {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

.coo-cell-gray {
  font-size: 11px;
  color: var(--text2);
  font-style: italic;
}

/* Site problem map */
.coo-site-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.coo-site-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.12s;
  color: inherit;
  font: inherit;
}

.coo-site-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.coo-site-card-worst {
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.15);
}

.coo-site-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.coo-site-name {
  font-size: 13px;
  font-weight: 800;
}

.coo-site-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.coo-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
}

.coo-badge.red {
  background: color-mix(in oklab, var(--neg) 15%, var(--card));
  color: var(--neg);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.coo-badge.yellow {
  background: color-mix(in oklab, var(--warn) 12%, var(--card));
  color: var(--warn);
  border: 1px solid rgba(251, 146, 60, 0.35);
}

.coo-site-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.coo-site-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coo-site-metrics span {
  font-size: 9px;
  color: var(--text2);
  text-transform: uppercase;
}

.coo-site-metrics strong {
  font-size: 12px;
  font-weight: 700;
}

.coo-site-worst {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.35;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* Action list */
.coo-action-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.coo-action-filters label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
}

.coo-action-filters select {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 10px;
  padding: 3px 6px;
}

.coo-action-filters label.action-list-status-filter-label {
  flex: 0 1 auto;
}

.coo-action-filters select.action-list-status-filter {
  min-width: 108px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.coo-action-filters select.action-list-status-filter:hover {
  border-color: var(--text2);
  background: var(--card);
}

.coo-action-filters select.action-list-status-filter:focus {
  outline: none;
  border-color: var(--accent, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.coo-action-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text2);
}

.coo-action-items {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.coo-action-item {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--card2);
  border-left: 3px solid var(--border);
}

.coo-action-item.status-red { border-left-color: var(--neg); }
.coo-action-item.status-yellow { border-left-color: var(--warn); }

.coo-action-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 10px;
}

.coo-action-site {
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--card);
  border: 1px solid var(--border);
}

.coo-action-kpi {
  font-weight: 600;
}

.coo-action-type {
  color: var(--text2);
  font-size: 9px;
  text-transform: uppercase;
}

.coo-action-problem {
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 3px;
}

.coo-action-delta {
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
}

/* Action layer (T4.1) — shared + role extensions */
.action-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: auto;
}

.action-status-badge.status-new { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.action-status-badge.status-inprogress { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.action-status-badge.status-blocked { background: rgba(248, 113, 113, 0.15); color: var(--neg); }
.action-status-badge.status-done { background: rgba(74, 222, 128, 0.15); color: var(--pos); }
.action-status-badge.status-rejected { background: rgba(120, 120, 120, 0.2); color: var(--text2); }
.action-status-badge.status-overdue { background: rgba(248, 113, 113, 0.25); color: #f87171; }

.action-rec {
  font-size: 10.5px;
  color: var(--text);
  line-height: 1.35;
  margin: 4px 0;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: var(--text2);
  margin: 4px 0 6px;
}

.action-origin-auto,
.action-origin-manual {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
}

.action-origin-auto { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.action-origin-manual { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }

.action-row-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.action-status-select-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
}

.action-status-select,
.action-form input,
.action-form textarea,
.action-form select {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 10px;
  padding: 4px 6px;
  font-family: inherit;
}

.action-status-select { min-width: 110px; }

.action-btn {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  min-height: 32px;
}

.action-btn:hover { border-color: var(--text2); }

.action-btn-primary {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

.action-btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--neg);
}

.action-btn-sm { padding: 3px 8px; min-height: 28px; }

.action-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  display: grid;
  gap: 8px;
}

.action-form-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
}

.action-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  color: var(--text2);
  font-weight: 600;
}

.action-form textarea { resize: vertical; min-height: 44px; }

.action-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* COO tracked actions + system suggestions (v109) */
.coo-block-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text2);
  margin: 0 0 8px;
}

.coo-tracked-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coo-tracked-items,
.coo-suggestion-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coo-tracked-item {
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
}

.coo-tracked-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.coo-tracked-id {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text2);
}

.coo-tracked-site {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(124, 131, 255, 0.12);
  color: var(--accent);
}

.coo-tracked-priority {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.coo-tracked-priority.priority-critical { background: rgba(248, 113, 113, 0.18); color: var(--neg); }
.coo-tracked-priority.priority-high { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.coo-tracked-priority.priority-medium { background: rgba(251, 191, 36, 0.12); color: var(--warn); }
.coo-tracked-priority.priority-low { background: rgba(120, 120, 120, 0.15); color: var(--text2); }

.coo-tracked-problem,
.coo-tracked-action {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.coo-tracked-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text2);
  margin-top: 6px;
}

.coo-tracked-deadline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.coo-overdue-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.coo-tracked-secondary {
  font-size: 10px;
  color: var(--text2);
  margin-top: 6px;
  line-height: 1.35;
}

.coo-tracked-fallback {
  padding: 14px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--card2);
  color: var(--text2);
  font-size: 12px;
  text-align: center;
}

.coo-tracked-loading {
  font-style: italic;
}

.coo-suggestions-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.coo-suggestions-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
}

.coo-suggestions-toggle:hover {
  border-color: var(--text2);
  color: var(--text);
}

.coo-suggestions-chevron {
  font-size: 10px;
  opacity: 0.8;
}

.coo-suggestions-hint {
  font-size: 10px;
  color: var(--text2);
  margin: 6px 2px 0;
  line-height: 1.35;
  font-style: italic;
}

.coo-suggestions-body {
  display: none;
  margin-top: 8px;
}

.coo-suggestions-body.is-open {
  display: block;
}

.coo-suggestion-item {
  background: color-mix(in oklab, var(--card2) 88%, var(--bg));
  border: 1px solid var(--border);
  border-left: 3px solid color-mix(in oklab, var(--text2) 35%, var(--border));
  border-radius: 8px;
  padding: 8px 10px;
  opacity: 0.88;
}

.coo-suggestion-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 4px;
}

.coo-suggestion-problem {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text);
}

.coo-suggestion-rec {
  font-size: 10.5px;
  color: var(--text2);
  margin-top: 4px;
  line-height: 1.35;
}

@media (max-width: 375px) {
  .coo-tracked-head,
  .coo-tracked-meta,
  .coo-action-filters {
    gap: 4px;
  }

  .coo-tracked-item,
  .coo-suggestion-item {
    padding: 8px 10px;
  }

  .coo-action-filters select {
    max-width: 100%;
  }
}

/* Owner top actions (T4.1) */
.owner-action {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.owner-action-main {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.owner-action-body { flex: 1; min-width: 0; }

.owner-action-rec {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
}

.owner-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: var(--text2);
  margin-top: 4px;
}

.owner-action-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text2);
}

.owner-action-status select {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 10px;
  padding: 3px 6px;
  min-height: 32px;
}

.owner-action-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.owner-action-details-btn {
  background: #1e88e5;
  border: none;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.owner-action-details-btn:hover {
  background: #1565c0;
}

.owner-action-details-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Action details slider (Top actions) */
.action-slider-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  visibility: hidden;
}

.action-slider-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
}

.action-slider-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 300ms ease;
}

.action-slider-overlay.is-open .action-slider-backdrop {
  opacity: 1;
}

.action-slider-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 300ms ease;
  z-index: 10051;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.action-slider-panel.is-open {
  transform: translateX(0);
}

body.action-slider-open {
  overflow: hidden;
}

.action-slider-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.action-slider-body {
  flex: 1;
  overflow-y: auto;
  padding: 48px 18px 24px;
}

.action-slider-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 10px;
  padding-right: 36px;
}

.action-slider-status {
  margin-bottom: 14px;
}

.action-slider-meta {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 11px;
}

.action-slider-meta dt {
  color: var(--text2);
  font-weight: 600;
  margin-bottom: 2px;
}

.action-slider-meta dd {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.action-slider-section {
  margin-bottom: 16px;
}

.action-slider-section h3 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin: 0 0 6px;
}

.action-slider-text {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
}

.action-slider-id {
  font-size: 9px;
  color: var(--text2);
  margin-top: 12px;
  word-break: break-all;
}

.action-slider-empty {
  font-size: 12px;
  color: var(--text2);
}

@media (max-width: 480px) {
  .action-slider-panel {
    width: 90%;
    max-width: 400px;
  }
}

/* Site actions panel */
.site-actions-panel {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
}

.site-actions-panel h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.site-action-items {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.site-action-item {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--card2);
  border-left: 3px solid var(--border);
}

.site-action-item.status-red { border-left-color: var(--neg); }
.site-action-item.status-yellow { border-left-color: var(--warn); }

.site-action-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.site-action-problem {
  font-size: 11px;
  line-height: 1.35;
  font-weight: 600;
}

@media (max-width: 480px) {
  .action-form-row { grid-template-columns: 1fr; }
  .coo-action-filters label { flex: 1 1 45%; }
  .coo-action-filters label.action-list-status-filter-label { flex: 1 1 100%; max-width: 100%; }
  .coo-action-filters select.action-list-status-filter {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: 36px;
    font-size: 12px;
    padding: 6px 8px;
  }
}

/* Diagnostic layer */
.coo-diagnostic {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.coo-diag-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.coo-diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.coo-diag-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 14px;
  min-width: 0;
}

.coo-diag-card h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.coo-diag-wide {
  grid-column: 1 / -1;
}

.coo-diag-note {
  font-size: 10px;
  color: var(--text2);
  margin-top: 8px;
  font-style: italic;
}

.coo-table-wrap {
  overflow-x: auto;
}

.coo-table {
  width: 100%;
  border-collapse: collapse;
}

.coo-table th,
.coo-table td {
  padding: 8px 10px;
  text-align: right;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.coo-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
}

.coo-table th:first-child,
.coo-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.coo-pf-green { color: var(--pos); }
.coo-pf-yellow { color: var(--warn); }
.coo-pf-red { color: var(--neg); }
.coo-pf-gray { color: var(--text2); font-style: italic; }

.coo-diag-site-row.coo-row-highlight {
  background: color-mix(in oklab, var(--accent) 12%, var(--card));
  outline: 1px solid var(--accent);
}

.coo-share-table {
  margin-bottom: 10px;
}

.coo-chart-wrap {
  position: relative;
  height: 200px;
  min-height: 120px;
}

/* Waterfall (reuse owner pattern) */
.coo-waterfall-wrap { margin-top: 6px; }

.coo-waterfall-table .coo-wf-rub {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.coo-waterfall-table .coo-wf-pct {
  text-align: right;
  width: 56px;
}

.coo-wf-minus .coo-wf-label { color: var(--warn); }
.coo-wf-subtotal .coo-wf-label { font-weight: 600; }
.coo-wf-total .coo-wf-label { font-weight: 700; color: var(--pos); }
.coo-wf-start .coo-wf-label { font-weight: 600; }

.coo-wf-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.coo-wf-fill { height: 100%; border-radius: 3px; }
.coo-wf-fill-start,
.coo-wf-fill-subtotal,
.coo-wf-fill-total { background: #7c83ff; }
.coo-wf-fill-minus { background: #fb923c; }

.coo-wf-note {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text2);
}

/* Gray stubs */
.coo-stub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.coo-stub-card {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  opacity: 0.65;
}

.coo-stub-icon {
  font-size: 18px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.coo-stub-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.coo-stub-text {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

/* COO mobile: KPI + карта + action list first */
@media (max-width: 900px) {
  .coo-exec-row {
    grid-template-columns: 1fr;
  }

  .coo-site-map {
    grid-template-columns: 1fr;
  }

  .coo-diag-grid {
    grid-template-columns: 1fr;
  }

  .coo-header-controls {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .coo-kpi-value {
    font-size: 20px;
  }

  .coo-chart-wrap {
    height: 160px;
  }
}

/* ── Site page (Этап 3) ──────────────────────────────────────────────── */
.site-role-page {
  padding-bottom: 24px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.site-header-main {
  min-width: 0;
  flex: 1 1 200px;
}

.site-title {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}

.site-subtitle {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

.site-invite {
  color: var(--warn);
  font-weight: 600;
}

.site-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.site-ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.site-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.site-selector-hint {
  font-size: 10px;
  color: var(--warn);
  font-weight: 600;
}

.site-selector {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  min-width: 72px;
}

.site-period-select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  margin-left: 4px;
}

.site-header-controls .site-period-toolbar select,
.site-header-controls .site-period-toolbar input {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 11px;
  padding: 2px 5px;
}

.site-fresh-badge {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
}

.site-fresh-badge.ok { border-color: rgba(74, 222, 128, 0.35); color: var(--pos); }
.site-fresh-badge.warn { border-color: rgba(251, 146, 60, 0.35); color: var(--warn); }
.site-fresh-badge.err { border-color: rgba(248, 113, 113, 0.35); color: var(--neg); }

.site-executive {
  margin-bottom: 16px;
}

.site-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.site-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  min-width: 0;
}

.site-kpi-card.status-green { border-color: rgba(74, 222, 128, 0.35); }
.site-kpi-card.status-yellow { border-color: rgba(251, 146, 60, 0.4); }
.site-kpi-card.status-red { border-color: rgba(248, 113, 113, 0.45); }
.site-kpi-card.status-gray { border-color: var(--border); opacity: 0.72; }

.site-kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.site-kpi-value {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.site-kpi-unit {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--text2);
}

.site-kpi-sub {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 6px;
}

.site-kpi-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 4px;
}

.site-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.site-status-dot.green { background: var(--pos); }
.site-status-dot.yellow { background: var(--warn); }
.site-status-dot.red { background: var(--neg); }
.site-status-dot.gray { background: var(--text2); opacity: 0.5; }

.site-kpi-delta {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.site-kpi-delta.up { color: var(--pos); }
.site-kpi-delta.down { color: var(--neg); }
.site-kpi-delta.flat { color: var(--text2); }

.site-kpi-interp {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.site-kpi-unavail {
  font-size: 14px;
  color: var(--text2);
  font-weight: 500;
}

.site-kpi-card.is-loading .site-kpi-value,
.site-kpi-card.is-loading .site-kpi-delta {
  opacity: 0.4;
}

.site-kpi-output-combined .site-kpi-value {
  font-size: inherit;
}

.site-output-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.site-output-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-output-key {
  font-size: 9px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
}

.site-output-val {
  font-size: 15px;
  font-weight: 700;
}

/* Блок «Место в группе» */
.site-place-panel {
  margin-top: 4px;
}

.site-place-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 14px 16px;
}

.site-place-title {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.site-place-sub {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 12px;
}

.site-place-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.site-place-metric {
  padding: 10px 12px;
  background: var(--card2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 8px;
}

.site-place-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.site-place-values {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.site-place-mine {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent, #7c83ff);
}

.site-place-vs {
  font-size: 10px;
  color: var(--text2);
}

.site-place-group-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.site-place-delta {
  font-size: 10px;
  font-weight: 600;
}

.site-place-delta.up { color: var(--pos); }
.site-place-delta.down { color: var(--neg); }
.site-place-delta.flat { color: var(--text2); }

.site-place-note {
  margin-top: 10px;
  font-size: 10px;
  color: var(--text2);
  font-style: italic;
}

.site-diagnostic {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.site-diag-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.site-diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.site-diag-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 14px;
  min-width: 0;
}

.site-diag-card h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.site-diag-sub {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 10px;
}

.site-diag-wide {
  grid-column: 1 / -1;
}

.site-empty {
  font-size: 12px;
  color: var(--text2);
  padding: 12px 0;
}

.site-cell-gray {
  color: var(--text2);
  font-style: italic;
  font-size: 11px;
}

.site-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  overscroll-behavior-x: contain;
}

.site-table {
  width: 100%;
  border-collapse: collapse;
}

.site-table th,
.site-table td {
  padding: 8px 10px;
  text-align: right;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.site-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
}

.site-table th:first-child,
.site-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.site-pf-green { color: var(--pos); }
.site-pf-yellow { color: var(--warn); }
.site-pf-red { color: var(--neg); }
.site-pf-gray { color: var(--text2); font-style: italic; }

.site-row-status {
  font-size: 10px;
  color: var(--text2);
}

.site-chart-wrap {
  position: relative;
  height: 200px;
  min-height: 120px;
}

.site-waterfall-wrap { margin-top: 6px; }

.site-waterfall-table .site-wf-rub {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.site-waterfall-table .site-wf-pct {
  text-align: right;
  width: 56px;
}

.site-wf-minus .site-wf-label { color: var(--warn); }
.site-wf-subtotal .site-wf-label { font-weight: 600; }
.site-wf-total .site-wf-label { font-weight: 700; color: var(--pos); }
.site-wf-start .site-wf-label { font-weight: 600; }

.site-wf-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.site-wf-fill { height: 100%; border-radius: 3px; }
.site-wf-fill-start,
.site-wf-fill-subtotal,
.site-wf-fill-total { background: #7c83ff; }
.site-wf-fill-minus { background: #fb923c; }

.site-wf-note {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text2);
}

.site-stub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.site-stub-card {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
  opacity: 0.65;
}

.site-stub-icon {
  font-size: 18px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.site-stub-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.site-stub-text {
  font-size: 11px;
  color: var(--text2);
  line-height: 1.4;
}

.site-init-error {
  max-width: 520px;
  margin: 40px auto;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--neg);
  border-radius: var(--radius, 10px);
}

.site-init-error h2 {
  font-size: 16px;
  margin: 0 0 10px;
  color: var(--neg);
}

.site-init-error p {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin: 0 0 8px;
}

.site-init-error-hint {
  font-size: 11px;
  opacity: 0.85;
}

@media (max-width: 900px) {
  .site-place-grid {
    grid-template-columns: 1fr;
  }

  .site-diag-grid {
    grid-template-columns: 1fr;
  }

  .site-header-controls {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .site-output-dual {
    grid-template-columns: 1fr;
  }

  .site-chart-wrap {
    height: 160px;
  }
}

/* ── T3.4-MOBILE: Executive KPI + таблицы ─────────────────────────────── */
/* owner: inline style grid-template-columns:repeat(4,…) в owner.js — !important только для owner */
@media (max-width: 768px) and (min-width: 480px) {
  .owner-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .coo-kpi-grid,
  .site-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

@media (max-width: 479px) {
  .owner-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .coo-kpi-grid,
  .site-kpi-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .owner-kpi-value,
  .coo-kpi-value,
  .site-kpi-value {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .site-place-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .site-place-metric {
    min-width: 0;
  }

  .site-place-values {
    flex-wrap: wrap;
  }

  .site-diag-card {
    min-width: 0;
    overflow: visible;
  }

  .site-role-page,
  .coo-role-page,
  .owner-role-page {
    min-width: 0;
    max-width: 100%;
  }

  .site-table-wrap {
    display: block;
    width: 100%;
    margin: 0;
  }

  .site-table {
    width: max-content;
    min-width: 100%;
  }
}
