/*
Theme Name:        Dnestrenergo Modern
Theme URI:         https://dnestrenergo.md
Description:       Production-grade theme for GUP "GK Dnestrenergo" — System Operator of the PMR power grid. Clean white/red corporate design with live energy dashboard.
Author:            Dnestrenergo Dev Team
Version:           1.0.2
Requires at least: 6.0
Tested up to:      6.7
Requires PHP:      8.0
License:           Proprietary
Text Domain:       dnestrenergo
Tags:              corporate, energy, dashboard, white, minimal
*/

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */
:root {
  /* Primary */
  --color-white:       #FFFFFF;
  --color-red:         #0C6B78;
  --color-red-dark:    #094E5A;
  --color-red-light:   #D6EEF1;
  --color-red-mid:     #1A7D8A;

  /* Neutrals */
  --color-beige:       #FAF8F3;
  --color-beige-light: #FDFCFA;
  --color-beige-mid:   #F0EDE6;
  --color-gray-900:    #111827;
  --color-gray-700:    #374151;
  --color-gray-500:    #6B7280;
  --color-gray-400:    #9CA3AF;
  --color-gray-200:    #E5E7EB;
  --color-gray-100:    #F3F4F6;

  /* Typography */
  --font-sans:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display:      'Inter', system-ui, sans-serif;

  /* Spacing */
  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   1.5rem;
  --space-xl:   2rem;
  --space-2xl:  3rem;
  --space-3xl:  4rem;
  --space-4xl:  6rem;

  /* Layout */
  --container-max:  1280px;
  --container-wide: 1440px;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 40px rgba(0,0,0,.10), 0 8px 16px rgba(0,0,0,.06);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  color: var(--color-gray-700);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-red-dark); }

ul, ol { list-style: none; }

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-gray-900);
}

/* ==========================================================================
   Layout Utilities
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-xl);
}
.container--wide {
  max-width: var(--container-wide);
}

.section-padding {
  padding-block: var(--space-4xl);
}

.grid { display: grid; gap: var(--space-xl); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-red { color: var(--color-red); }
.text-gray { color: var(--color-gray-500); }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
  transition: background .3s, box-shadow .3s, border-color .3s;
}

/* Transparent header over slideshow — front page only */
body.home .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: none;
  box-shadow: none;
}
body.home .header-topbar {
  background: transparent;
  transition: max-height .3s, padding .3s, opacity .3s;
}
body.home .header-main {
  background: transparent;
  transition: background .4s;
}
body.home .logo-title { color: #EE3537; transition: color .4s; }
body.home .logo-subtitle { color: rgba(255,255,255,.75); transition: color .4s; }
body.home .nav-menu > li > a {
  color: rgba(255,255,255,.9);
  transition: color .2s, background .2s;
}
body.home .nav-menu > li > a:hover,
body.home .nav-menu > li.current-menu-item > a {
  color: #fff;
  background: rgba(255,255,255,.15);
}
body.home .header-live-lbl { color: rgba(255,255,255,.85); transition: color .4s; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
body.home .header-live-unit { color: rgba(255,255,255,.7); transition: color .4s; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
body.home .header-live-col { border-left: none; }
body.home .site-header:not(.scrolled) .header-live-val { color: #4ADE80; text-shadow: 0 1px 4px rgba(0,0,0,.7); }

/* Transparent dropdown when header is transparent */
body.home .site-header:not(.scrolled) .nav-menu .sub-menu {
  background: rgba(15,15,15,.72);
  border-color: rgba(255,255,255,.1);
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body.home .site-header:not(.scrolled) .sub-menu li a {
  color: rgba(255,255,255,.92);
  text-shadow: none;
}
body.home .site-header:not(.scrolled) .sub-menu li a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* Scrolled state — solid white */
body.home .site-header.scrolled {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
}
body.home .site-header.scrolled .header-topbar { background: var(--color-gray-900); }
body.home .site-header.scrolled .header-main { background: var(--color-white); }
body.home .site-header.scrolled .logo-title { color: #EE3537; }
body.home .site-header.scrolled .logo-subtitle { color: var(--color-gray-500); }
body.home .site-header.scrolled .nav-menu > li > a { color: var(--color-gray-700); }
body.home .site-header.scrolled .nav-menu > li > a:hover,
body.home .site-header.scrolled .nav-menu > li.current-menu-item > a {
  color: var(--color-red);
  background: var(--color-red-light);
}
body.home .site-header.scrolled .header-live-lbl { color: var(--color-gray-500); text-shadow: none; }
body.home .site-header.scrolled .header-live-unit { color: var(--color-gray-400); text-shadow: none; }
body.home .site-header.scrolled .header-live-val { color: #16a34a; text-shadow: none; }
body.home .site-header.scrolled .header-live-col { border-left-color: rgba(0,0,0,.08); }

.header-topbar {
  background: var(--color-gray-900);
  color: var(--color-gray-400);
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  max-height: 60px;
  overflow: hidden;
}
.header-topbar.hidden {
  max-height: 0;
  padding-block: 0;
  opacity: 0;
}
  font-size: 0.8125rem;
  padding-block: 6px;
}
.header-topbar {
  background: var(--color-gray-900);
  color: var(--color-gray-400);
  font-size: 0.8rem;
  padding-block: 6px;
}
.header-topbar > .container {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 20px;
  max-width: 100% !important;
  padding-inline: 24px !important;
}
.tb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-gray-400);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.tb-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.tb-item:hover { color: var(--color-white); }
.tb-status { margin-left: auto; }
.topbar-status-dot {
  width: 6px;
  height: 6px;
  background: #4ADE80;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
.topbar-live { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; }
.topbar-live-item { color: var(--color-gray-400); white-space: nowrap; }
.topbar-live-item strong { color: #4ADE80; font-weight: 700; }
.topbar-live-sep { color: var(--color-gray-600); font-size: 0.7rem; }

.header-main {
  padding-block: 7px;
}
.header-main .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 20px;
  max-width: 1480px;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}
.logo-img {
  width: auto;
  height: 62px;
  object-fit: contain;
  flex-shrink: 0;
}
.logo-mark {
  width: 48px; height: 48px;
  background: var(--color-red);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 28px; height: 28px; color: var(--color-white); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; gap: 4px; }
.logo-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #EE3537;
  letter-spacing: -0.02em;
}
.logo-subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Primary Navigation */
.primary-nav { display: flex; align-items: center; }
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-menu > li { position: relative; }
.nav-menu > li > a {
  display: block;
  padding: 10px 9px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--color-gray-700);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a {
  color: var(--color-red);
  background: var(--color-red-light);
}

/* Dropdown */
.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  z-index: 100;
}
.nav-menu > li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sub-menu li a {
  display: block;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--color-gray-700);
  transition: all var(--transition-fast);
}
.sub-menu li:first-child a { border-radius: 0; }
.sub-menu li:last-child a  { border-radius: 0; }
.sub-menu li a:hover {
  background: var(--color-red-light);
  color: var(--color-red);
}

/* Header CTA */
.header-cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Live energy column in header */
.header-live-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: none;
  padding: 6px 10px 6px 10px;
}
.header-live-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.header-live-lbl {
  font-size: 0.72rem;
  color: var(--color-gray-500);
  min-width: 60px;
}
.header-live-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
}
.header-live-unit {
  font-size: 0.68rem;
  color: var(--color-gray-400);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-gray-700);
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 2px;
}

/* Gutenberg button blocks — текст всегда белый поверх любого фона */
.wp-block-button__link,
.wp-element-button,
.wp-block-file__button {
  color: #fff !important;
  text-decoration: none !important;
}
.wp-block-button__link:hover,
.wp-element-button:hover,
.wp-block-file__button:hover {
  color: #fff !important;
  opacity: 0.85;
}

.btn-primary {
  background: var(--color-red);
  color: var(--color-white);
  border-color: var(--color-red);
}
.btn-primary:hover {
  background: var(--color-red-dark);
  border-color: var(--color-red-dark);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(12,107,120,.35);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-red);
  border-color: var(--color-red);
}
.btn-secondary:hover {
  background: var(--color-red-light);
  color: var(--color-red-dark);
  border-color: var(--color-red-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--color-gray-700);
  border-color: var(--color-gray-200);
}
.btn-ghost:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-900);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.8125rem;
}
.btn-lg {
  padding: 14px 30px;
  font-size: 1rem;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  background: var(--color-white);
  padding-block: var(--space-4xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 500px at 75% 50%, rgba(12,107,120,.04) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 10% 80%, rgba(12,107,120,.03) 0%, transparent 60%);
  pointer-events: none;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-4xl);
  position: relative;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-red-light);
  color: var(--color-red);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: var(--space-lg);
}
.hero-label .pulse {
  width: 8px; height: 8px;
  background: var(--color-red);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(12,107,120,.4); }
  50% { opacity: .8; transform: scale(1.1); box-shadow: 0 0 0 6px rgba(12,107,120,0); }
}

/* Red pulse — hero "Системный оператор" & "Live" dots stay red */
@keyframes pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(238,53,55,.4); }
  50% { opacity: .8; transform: scale(1.1); box-shadow: 0 0 0 6px rgba(238,53,55,0); }
}
.hero-label .pulse {
  background: #EE3537 !important;
  animation: pulse-red 2s ease-in-out infinite !important;
}
.hero-panel-title .dot {
  background: #EE3537 !important;
  animation: pulse-red 2s ease-in-out infinite !important;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--color-gray-900);
  margin-bottom: var(--space-lg);
}
.hero-title .accent { color: var(--color-red); }

.hero-description {
  font-size: 1.1rem;
  color: var(--color-gray-500);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  max-width: 520px;
  text-align: justify;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
}

.hero-stats {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-gray-200);
}
.hero-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding-right: var(--space-lg);
}
.hero-stat-item + .hero-stat-item {
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  border-left: 1px solid var(--color-gray-200);
}
.hero-stat-item:last-child { padding-right: 0; }
.hero-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
  line-height: 1;
}
.hero-stat-num span { color: var(--color-red); }
.hero-stat-label {
  font-size: 0.7rem;
  color: var(--color-gray-500);
  font-weight: 500;
  line-height: 1.3;
}

/* Hero visual panel */
.hero-visual {
  position: relative;
}

/* Donut chart variant — компактный фиксированный размер */
.hero-visual--donut {
  display: flex;
  align-items: center;
}
.hero-visual--donut .chart-card {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  box-shadow: none;
}
.hero-visual--donut .chart-card-header {
  padding: 10px 16px;
}
.hero-visual--donut .chart-card-body {
  padding: 8px 16px 12px;
}
.hero-visual--donut .chart-container {
  height: 140px;
  position: relative;
}
.hero-visual--donut .donut-stats {
  margin-top: 4px;
}
.hero-visual--donut .donut-stat-item {
  padding-block: 4px;
}
.hero-visual--donut .donut-stat-label,
.hero-visual--donut .donut-stat-val {
  font-size: 0.82rem;
}
.hero-panel {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.hero-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-gray-200);
  background: var(--color-beige-light);
}
.hero-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-panel-title .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-red);
  animation: pulse 2s ease-in-out infinite;
}
.hero-panel-badge {
  font-size: 0.75rem;
  color: var(--color-gray-500);
  background: var(--color-gray-100);
  padding: 3px 10px;
  border-radius: 100px;
}
.hero-panel-body { padding: var(--space-lg); }

/* Mini metric cards in hero */
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.hero-metric {
  background: var(--color-beige-light);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}
.hero-metric-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
}
.hero-metric-val.up  { color: var(--color-red); }
.hero-metric-unit    { font-size: 0.7rem; font-weight: 600; color: var(--color-gray-500); margin-top: 2px; }
.hero-metric-label   { font-size: 0.7rem; color: var(--color-gray-500); margin-top: 4px; }

/* Chart area placeholder */
.hero-chart-area {
  height: 160px;
  position: relative;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Floating badge */
.hero-badge {
  position: absolute;
  top: -14px;
  right: -14px;
  background: var(--color-red);
  color: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: 0 8px 24px rgba(12,107,120,.3);
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 10;
}
.hero-badge .num {
  font-size: 1.5rem;
  font-weight: 800;
  display: block;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
.section-header { margin-bottom: var(--space-2xl); }
.section-header.text-center { max-width: 640px; margin-inline: auto; margin-bottom: var(--space-2xl); }

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-red);
  margin-bottom: var(--space-sm);
}
.section-eyebrow::before {
  content: '';
  display: block;
  width: 20px; height: 2px;
  background: var(--color-red);
  border-radius: 2px;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.section-description {
  font-size: 1.05rem;
  color: var(--color-gray-500);
  line-height: 1.7;
}

/* ==========================================================================
   Dashboard / Metrics Section
   ========================================================================== */
.dashboard-section {
  background: var(--color-beige);
  padding-block: var(--space-4xl);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.kpi-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--color-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}
.kpi-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.kpi-card:hover::after { transform: scaleX(1); }

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.kpi-icon {
  width: 44px; height: 44px;
  background: var(--color-red-light);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; color: var(--color-red); }

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}
.kpi-trend.up   { background: #DCFCE7; color: #15803D; }
.kpi-trend.down { background: var(--color-red-light); color: var(--color-red-dark); }
.kpi-trend.flat { background: var(--color-gray-100); color: var(--color-gray-500); }

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-unit {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-gray-500);
  margin-left: 2px;
}
.kpi-label {
  font-size: 0.875rem;
  color: var(--color-gray-500);
  margin-bottom: var(--space-md);
}
.kpi-progress {
  height: 4px;
  background: var(--color-gray-200);
  border-radius: 2px;
  overflow: hidden;
}
.kpi-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-red), var(--color-red-mid));
  border-radius: 2px;
  transition: width 1s ease;
}

/* Charts Row */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-xl);
}

.chart-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-gray-200);
}
.chart-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-gray-900);
  display: flex; align-items: center; gap: var(--space-sm);
}
.chart-card-actions { display: flex; align-items: center; gap: var(--space-sm); }
.chart-pill {
  font-size: 0.775rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-gray-200);
  color: var(--color-gray-500);
  background: transparent;
}
.chart-pill.active, .chart-pill:hover {
  background: var(--color-red);
  color: var(--color-white);
  border-color: var(--color-red);
}
.chart-card-body {
  padding: var(--space-xl);
  position: relative;
}
.chart-container { position: relative; }

/* Voltage legend */
.voltage-legend {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--color-gray-500);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Donut chart card */
.donut-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.donut-stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-gray-200);
}
.donut-stat-item:last-child { border-bottom: none; }
.donut-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--color-gray-700);
}
.donut-stat-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-gray-900);
}

/* ==========================================================================
   Services / Infrastructure Cards
   ========================================================================== */
.services-section {
  background: var(--color-beige);
  padding-block: var(--space-4xl);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.service-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-red), var(--color-red-mid));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}
.service-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
  border-color: var(--color-red-light);
}
.service-card:hover::before { transform: scaleX(1); }

.service-icon-wrap {
  width: 56px; height: 56px;
  background: var(--color-red-light);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-xl);
  transition: all var(--transition-base);
}
.service-card:hover .service-icon-wrap {
  background: var(--color-red);
}
.service-icon-wrap svg {
  width: 28px; height: 28px;
  color: var(--color-red);
  transition: color var(--transition-base);
}
.service-card:hover .service-icon-wrap svg { color: var(--color-white); }

.service-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gray-900);
  margin-bottom: var(--space-sm);
}
.service-description {
  font-size: 0.9rem;
  color: var(--color-gray-500);
  line-height: 1.65;
  margin-bottom: var(--space-xl);
}
.service-specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.service-spec-tag {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--color-red);
  background: var(--color-red-light);
  padding: 4px 10px;
  border-radius: 100px;
}
.service-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-red);
  margin-top: var(--space-lg);
  transition: gap var(--transition-fast);
}
.service-link:hover { gap: 10px; }
.service-link svg { width: 16px; height: 16px; }

/* ==========================================================================
   News / Announcements
   ========================================================================== */
.news-section {
  background: var(--color-white);
  padding-block: var(--space-2xl);
}

.news-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  gap: var(--space-lg);
}

.news-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-xl);
}

.news-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}
.news-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.news-card-featured {
  display: grid;
  grid-template-columns: 1fr;
}

.news-card-image {
  aspect-ratio: 16/7;
  background: linear-gradient(135deg, var(--color-beige-mid) 0%, var(--color-gray-200) 100%);
  position: relative;
  overflow: hidden;
}
.news-card-image img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.news-card-image-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.news-card-image-placeholder svg {
  width: 48px; height: 48px;
  color: var(--color-gray-400);
}

.news-card-cat {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  background: var(--color-red);
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 100px;
}

.news-card-body { padding: var(--space-xl); }
.news-card-date {
  font-size: 0.8rem;
  color: var(--color-gray-400);
  margin-bottom: var(--space-sm);
  display: flex; align-items: center; gap: 6px;
}
.news-card-date svg,
.page-header svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.news-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gray-900);
  margin-bottom: var(--space-sm);
  line-height: 1.35;
  transition: color var(--transition-fast);
}
.news-card:hover .news-card-title { color: var(--color-red); }
.news-card-excerpt {
  font-size: 0.9rem;
  color: var(--color-gray-500);
  line-height: 1.65;
}
.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-beige-light);
}

/* Side news list */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.news-list-item {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--transition-base);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}
.news-list-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-red-light);
}
.news-list-num {
  width: 32px; height: 32px;
  background: var(--color-red-light);
  color: var(--color-red);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}
.news-list-content {}
.news-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-gray-900);
  line-height: 1.4;
  margin-bottom: 4px;
  transition: color var(--transition-fast);
}
.news-list-item:hover .news-list-title { color: var(--color-red); }
.news-list-date { font-size: 0.775rem; color: var(--color-gray-400); }

/* ==========================================================================
   Status Bar
   ========================================================================== */
.status-bar {
  background: var(--color-gray-900);
  color: var(--color-white);
  padding-block: var(--space-lg);
  overflow: hidden;
}
.status-bar .container {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
}
.status-bar-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-red);
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.status-items {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  flex: 1;
}
.status-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-item-label {
  font-size: 0.7rem;
  color: var(--color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-item-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: -0.01em;
}
.status-item-value .unit {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-gray-400);
  margin-left: 2px;
}
.status-item.online .status-item-value { color: #4ADE80; }
.status-item.warning .status-item-value { color: #FACC15; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--color-beige);
  border-top: 1px solid var(--color-beige-mid);
}

.footer-main {
  padding-block: var(--space-xl);
}
.footer-main .container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-2xl);
}

.footer-brand .site-logo { margin-bottom: var(--space-lg); }
.footer-brand .logo-img { filter: none !important; height: 48px; }
.footer-brand .logo-title { color: #EE3537 !important; }
.footer-brand .logo-subtitle { color: var(--color-gray-500) !important; }
.footer-brand p {
  font-size: 0.9rem;
  color: var(--color-gray-500);
  line-height: 1.7;
  max-width: 300px;
  margin-bottom: var(--space-xl);
}
.footer-social {
  display: flex; gap: var(--space-sm);
}
.social-link {
  width: 36px; height: 36px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-gray-500);
  transition: all var(--transition-fast);
}
.social-link:hover {
  background: var(--color-red);
  border-color: var(--color-red);
  color: var(--color-white);
}
.social-link svg { width: 16px; height: 16px; }

.footer-col-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-gray-900);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-lg);
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.footer-links a {
  font-size: 0.9rem;
  color: var(--color-gray-500);
  transition: all var(--transition-fast);
  display: flex; align-items: center; gap: 6px;
}
.footer-links a:hover {
  color: var(--color-red);
  padding-left: 4px;
}
.footer-links a::before {
  content: '';
  display: block;
  width: 0;
  height: 1px;
  background: var(--color-red);
  transition: width var(--transition-fast);
}
.footer-links a:hover::before { width: 8px; }

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  color: var(--color-gray-500);
}
.footer-contact-item svg {
  width: 16px; height: 16px;
  color: var(--color-red);
  flex-shrink: 0;
  margin-top: 2px;
}

.footer-bottom {
  border-top: 1px solid var(--color-beige-mid);
  padding-block: var(--space-lg);
}
.footer-bottom .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.footer-copyright {
  font-size: 0.8rem;
  color: var(--color-gray-500);
}
.footer-legal {
  display: flex;
  gap: var(--space-lg);
}
.footer-legal a {
  font-size: 0.8rem;
  color: var(--color-gray-500);
}
.footer-legal a:hover { color: var(--color-red); }

/* Dispatcher button stays red (brand exception) */
.dispatcher-btn {
  background: #EE3537 !important;
  border-color: #EE3537 !important;
  color: #fff !important;
}
.dispatcher-btn:hover {
  background: #B91C1C !important;
  border-color: #B91C1C !important;
  box-shadow: 0 4px 12px rgba(238,53,55,.35) !important;
}
.dispatcher-btn:focus-visible { outline-color: #EE3537 !important; }

/* ==========================================================================
   Dispatcher Popup
   ========================================================================== */
.dispatcher-wrap {
    position: relative;
}

.dispatcher-popup {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-lg);
    z-index: 200;
    animation: popup-in 0.18s ease;
}
.dispatcher-popup::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    width: 12px; height: 12px;
    background: var(--color-white);
    border-left: 1px solid var(--color-gray-200);
    border-top: 1px solid var(--color-gray-200);
    transform: rotate(45deg);
}

@keyframes popup-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dispatcher-popup-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-gray-400);
    margin-bottom: var(--space-sm);
}

.dispatcher-popup-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--color-gray-900);
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast);
    margin-bottom: var(--space-xs);
}
.dispatcher-popup-phone svg {
    width: 18px; height: 18px;
    color: var(--color-red);
    flex-shrink: 0;
}
.dispatcher-popup-phone:hover { color: var(--color-red); }

.dispatcher-popup-note {
    font-size: 0.775rem;
    color: var(--color-gray-400);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-gray-200);
}
.dispatcher-popup-note::before {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    background: #4ADE80;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==========================================================================
   Page / Post Content
   ========================================================================== */
.page-header {
  background: var(--color-white);
  padding-block: var(--space-2xl);
  border-bottom: 1px solid var(--color-gray-200);
}
.page-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--color-gray-400);
  margin-top: var(--space-sm);
}
.breadcrumb a { color: var(--color-gray-500); }
.breadcrumb a:hover { color: var(--color-red); }
.breadcrumb-sep { color: var(--color-gray-300); }

.entry-content {
  padding-block: var(--space-3xl);
}
/* Страница с дашбордом — убираем лишний воздух сверху */
.entry-content:has(.pmr-dash-root) {
  padding-block-start: var(--space-md);
}
.entry-content p { margin-bottom: var(--space-lg); }
.entry-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-block: var(--space-2xl) var(--space-md);
  letter-spacing: -0.02em;
}
.entry-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-block: var(--space-xl) var(--space-sm);
}
.entry-content ul, .entry-content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: var(--space-xs); }
.entry-content a { color: var(--color-red); text-decoration: underline; text-underline-offset: 3px; }
.entry-content blockquote {
  border-left: 4px solid var(--color-red);
  padding: var(--space-md) var(--space-xl);
  background: var(--color-red-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-block: var(--space-xl);
  font-style: italic;
  color: var(--color-gray-700);
}
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-xl);
  font-size: 0.9rem;
}
.entry-content th, .entry-content td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-gray-200);
}
.entry-content th {
  background: var(--color-beige);
  font-weight: 700;
  color: var(--color-gray-900);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; gap: var(--space-2xl); }
  .hero-visual { order: -1; }
  .services-grid { grid-template-columns: 1fr 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header-topbar { display: none; }
  .primary-nav, .header-cta { display: none; }
  .nav-toggle { display: flex; }

  .primary-nav.open {
    display: block;
    position: fixed;
    top: 65px; left: 0; right: 0; bottom: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    overflow-y: auto;
    z-index: 999;
    padding: var(--space-xl);
  }
  .primary-nav.open .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .primary-nav.open .nav-menu > li > a { padding: 12px 16px; }
  .primary-nav.open .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--color-red-light);
    border-radius: 0;
    margin-left: var(--space-md);
    margin-top: 4px;
  }

  .container { padding-inline: var(--space-lg); }
  .section-padding { padding-block: var(--space-3xl); }

  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .hero-stat-item { padding-right: var(--space-md); }
  .hero-stat-item + .hero-stat-item { padding-left: var(--space-md); padding-right: var(--space-md); }
  .hero-metrics { grid-template-columns: 1fr 1fr 1fr; }

  .status-items { gap: var(--space-lg); overflow-x: auto; }
  .footer-main .container { grid-template-columns: 1fr; }
  .footer-bottom .container { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .hero-metrics { grid-template-columns: repeat(3, 1fr); }
  .hero-actions { flex-direction: column; align-items: flex-start; }
  .hero-stats { flex-wrap: wrap; gap: var(--space-md); }
  .hero-stat-item { padding: 0; border-left: none !important; flex: 0 0 calc(50% - var(--space-sm)); }
}

/* О предприятии — компактный отступ */
#ob-kompanii { padding-block: var(--space-2xl); }

/* ==========================================================================
   WordPress Core Classes
   ========================================================================== */
.alignleft  { float: left; margin: 0 var(--space-xl) var(--space-lg) 0; }
.alignright { float: right; margin: 0 0 var(--space-lg) var(--space-xl); }
.aligncenter { margin-inline: auto; display: block; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 0.85rem; color: var(--color-gray-500); text-align: center; margin-top: 8px; }
.screen-reader-text { @extend .visually-hidden; }
.sticky { position: relative; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }

/* ==========================================================================
   Scroll animations
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
  }
  .fade-in-delay-1 { transition-delay: 0.1s; }
  .fade-in-delay-2 { transition-delay: 0.2s; }
  .fade-in-delay-3 { transition-delay: 0.3s; }
  .fade-in-delay-4 { transition-delay: 0.4s; }
}
