/* ====================================================================
   ЦДГ.Энергомощности: Полигон «Цифровой Двойник»
   Цветовая схема: оранжевый акцент (DT colour scheme)
   ==================================================================== */

/* --- Шрифт Panton --- */
@font-face {
  font-family: 'Panton';
  src: url('Panton-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal;
}
@font-face {
  font-family: 'Panton';
  src: url('Panton-Regular.otf') format('opentype');
  font-weight: 700; font-style: normal;
}

/* --- Палитра --- */
:root {
  --bg:         #FFFFFF;
  --bg-card:    #FAFAFA;
  --bg-side:    #F8F9FA;
  --bg-input:   #FFFFFF;
  --orange:     #FFA500;
  --orange-dk:  #CC8400;
  --text:       #2D2D44;
  --text-dim:   #666666;
  --border:     #E0E0E0;
  --success:    #06d183;
  --bg-success: #2aaa8a;
  --danger:     #EF5350;
}

/* === Глобальные === */
* {
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
}

body {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  font-size: 13px;
}

/* === Навбар === */
.navbar {
  background: #FFFFFF !important;
  border-bottom: 2px solid var(--orange) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  min-height: 50px;
}
.navbar-brand {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--orange) !important;
}

/* === Карточки === */
.card {
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  margin-bottom: 15px;
}
.card-header {
  background: #FFFFFF !important;
  color: var(--orange) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-bottom: 1px solid var(--orange) !important;
  padding: 8px 12px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body {
  padding: 12px;
}

/* === Заголовки === */
h1 { font-size: 16px !important; font-weight: 700; }
h2 { font-size: 13px !important; font-weight: 600; }
h3 { font-size: 12px !important; font-weight: 600; }
h4 { font-size: 11px !important; font-weight: 700; color: var(--orange); }

/* === Инфо-подсказки (Snippets) === */
.info-snippet {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 7px;
  border-radius: 50%;
  background: #E2E6EB;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  transition: background 0.2s, color 0.2s;
  vertical-align: middle;
}

.info-snippet:hover,
.info-snippet:focus,
.info-snippet.snippet-open {
  background: #D4DAE2;
  color: var(--orange);
  outline: none;
}

.snippet-floating-tooltip {
  position: fixed;
  z-index: 2147483647;
  display: none;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  padding: 9px 11px;
  border-radius: 6px;
  background: rgba(45, 45, 68, 0.98);
  color: #FFFFFF;
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.snippet-floating-tooltip.is-visible {
  display: block;
}

.local-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 auto;
}

/* === Сайдбар === */
.sidebar {
  background-color: var(--bg-side) !important;
  border-right: 1px solid var(--border) !important;
}

.sidebar,
.sidebar :not(.fa):not(.fas):not(.far):not(.fal):not(.fab):not(.glyphicon) {
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
}

.sidebar button,
.sidebar input,
.sidebar select,
.sidebar textarea,
.sidebar label,
.sidebar summary,
.sidebar .form-control,
.sidebar .selectize-control,
.sidebar .selectize-input,
.sidebar .selectize-input *,
.sidebar .selectize-dropdown,
.sidebar .selectize-dropdown *,
.sidebar .irs,
.sidebar .irs *,
.sidebar .pretty,
.sidebar .pretty *,
.sidebar .bootstrap-switch,
.sidebar .bootstrap-switch *,
.sidebar .shiny-input-container,
.sidebar .shiny-input-container *,
.sidebar-section-title,
.sidebar-field-label,
.structure-switch,
.structure-switch * {
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
}

.fa,
.fas,
.far,
.fal,
.fab,
.glyphicon,
.btn .fa,
.btn .fas,
.btn .far,
.btn .fal,
.btn .fab,
.sidebar .fa,
.sidebar .fas,
.sidebar .far,
.sidebar .fal,
.sidebar .fab,
.sidebar .glyphicon,
.bslib-value-box .value-box-showcase .fa,
.value-box .value-box-showcase .fa,
.bslib-value-box .value-box-showcase .fas,
.value-box .value-box-showcase .fas {
  font-family: FontAwesome, "Font Awesome 5 Free", "Font Awesome 6 Free", "Glyphicons Halflings" !important;
  font-weight: 900 !important;
}

.sidebar .fa,
.sidebar .fas,
.sidebar .far,
.sidebar .fal,
.sidebar .fab,
.sidebar .glyphicon,
.sidebar button .fa,
.sidebar button .fas,
.sidebar button .far,
.sidebar button .fal,
.sidebar button .fab,
.sidebar button .glyphicon {
  font-family: FontAwesome, "Font Awesome 5 Free", "Font Awesome 6 Free", "Glyphicons Halflings" !important;
  font-weight: 900 !important;
}

.sidebar .fa,
.sidebar .fas,
.sidebar .far,
.sidebar .fal,
.sidebar .fab,
.sidebar .glyphicon {
  display: inline-block;
  width: 18px;
  text-align: center;
}

.sidebar-header {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #DDE2E8;
  border-radius: 8px;
  background: #FFFFFF;
}

.sidebar-header-kicker {
  margin-bottom: 3px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.sidebar-header-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
}

.sidebar-action {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-height: 42px !important;
  margin: 0 0 12px !important;
  padding: 10px 14px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-transform: uppercase;
}

.sidebar-action .local-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  filter: brightness(0) invert(1);
}

.sidebar-action-secondary .local-icon {
  filter: none;
  opacity: 0.72;
}

.sidebar-action-secondary {
  margin-top: 12px !important;
  margin-bottom: 0 !important;
  border: 1px solid #DDE2E8 !important;
  background: #FFFFFF !important;
  color: var(--text-dim) !important;
}

.sidebar-action-secondary:hover,
.sidebar-action-secondary:focus {
  border-color: #C9D0D8 !important;
  background: #F1F3F5 !important;
  color: var(--text) !important;
}

.sidebar-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section {
  position: relative;
  padding: 0;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #ECEFF3;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.sidebar-section-title::-webkit-details-marker {
  display: none;
}

.sidebar-section-title::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #DCE1E8;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 800;
}

.sidebar-section[open] .sidebar-section-title::after {
  content: "-";
}

.sidebar-section-body {
  position: relative;
  padding-top: 2px;
}

.sidebar-field {
  position: relative;
  overflow: visible;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}

.sidebar-field:focus-within {
  z-index: 100;
}

.sidebar-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 10px 4px;
  background: #ECEFF3;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.sidebar-field .form-group,
.sidebar-field .shiny-input-container {
  width: 100% !important;
  margin: 0 !important;
}

.sidebar-field .form-control,
.sidebar-field .selectize-input,
.sidebar-field select {
  min-height: 38px !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background-color: #fff !important;
  font-size: 13px !important;
}

.sidebar-field .selectize-control {
  margin-bottom: 0 !important;
  z-index: 20;
}

.sidebar-field .selectize-input {
  padding: 8px 10px !important;
}

.sidebar .selectize-dropdown,
.selectize-dropdown {
  z-index: 10000 !important;
}

.slider-control {
  padding: 4px 10px 16px;
}

.slider-control .shiny-input-container {
  overflow: visible;
}

.slider-control .irs,
.slider-control .irs--shiny {
  height: 48px !important;
  margin: 0 !important;
}

.slider-control .irs-line,
.slider-control .irs-bar {
  top: 25px !important;
}

.slider-control .irs-handle {
  top: 18px !important;
}

.slider-control .irs-min,
.slider-control .irs-max,
.slider-control .irs-from,
.slider-control .irs-to,
.slider-control .irs-single {
  top: 0 !important;
}

.sidebar-field .form-switch,
.sidebar-field .pretty {
  margin: 9px 10px !important;
}

.structure-switch {
  padding: 8px 10px;
}

.structure-switch .pretty {
  display: flex !important;
  align-items: center;
  min-height: 24px;
  margin: 0 !important;
  white-space: normal;
}

.structure-switch .state label {
  color: var(--text);
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

/* === Формы === */
.form-control, .selectize-input {
  border-radius: 6px !important;
  font-size: 12px !important;
}
.btn-primary {
  background: linear-gradient(135deg, #FFA500, #E69500) !important;
  border: none !important;
  font-weight: 700;
  border-radius: 8px !important;
}

.help-snippet {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #ECEFF3 !important;
  color: var(--text-dim) !important;
  box-shadow: none !important;
}

.help-snippet .local-icon {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}

.help-snippet:hover,
.help-snippet:focus {
  background: #DCE1E8 !important;
  color: var(--orange) !important;
}

.city-cover-content {
  width: min(920px, calc(100% - 32px));
  text-align: center;
}

.city-cover-title {
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
  color: white;
  font-size: 30px !important;
  font-weight: 800;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.45);
  margin: 0;
}

.city-cover-industry {
  max-width: 860px;
  margin: 8px auto 0;
  color: rgba(255, 255, 255, 0.94);
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
  font-size: 15px !important;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 1px 1px 6px rgba(0,0,0,0.5);
}

.bslib-value-box,
.bslib-value-box *,
.value-box,
.value-box * {
  font-family: 'Panton', 'IBM Plex Sans', sans-serif !important;
}

.kpi-grid {
  margin-bottom: 14px;
}

.kpi-grid .bslib-value-box,
.kpi-grid .value-box {
  min-height: 88px !important;
  border: 1px solid #DDE2E8 !important;
  border-radius: 8px !important;
  background: #F1F3F5 !important;
  box-shadow: none !important;
  color: var(--text) !important;
}

.kpi-grid .bslib-value-box .value-box-area,
.kpi-grid .value-box .value-box-area {
  padding: 10px 12px !important;
}

.bslib-value-box .value-box-title,
.value-box .value-box-title {
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  color: var(--text) !important;
}

.kpi-title-with-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: visible;
}

.bslib-value-box .value-box-title,
.value-box .value-box-title,
.kpi-grid .bslib-value-box,
.kpi-grid .value-box {
  overflow: visible !important;
}

.kpi-title-with-help .info-snippet {
  margin-left: 0;
}

.bslib-value-box .value-box-value,
.value-box .value-box-value {
  font-size: 27px !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  color: var(--orange) !important;
}

.kpi-local-icon {
  width: 30px;
  height: 30px;
  opacity: 0.34;
  object-fit: contain;
}

/* === Editor page toggle toolbar === */
.dtwin-editor-page-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 0;
}

.dtwin-page-toggle-btn {
  font-weight: 600;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.dtwin-page-toggle-btn.active {
  background: var(--orange) !important;
  color: #fff !important;
  border-color: var(--orange) !important;
  box-shadow: 0 2px 8px rgba(255, 165, 0, 0.25);
}

/* === Monitoring table === */
.dtwin-monitoring-container {
  padding: 12px;
}

.dtwin-monitoring-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.dtwin-mon-table {
  border-collapse: separate;
  border-spacing: 6px 0;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}

.dtwin-mon-table th,
.dtwin-mon-table td {
  border: none;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  transition: background 0.25s ease;
}

.dtwin-mon-phase-header {
  background: #FFF3E0;
  color: var(--text);
  font-weight: 1000;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 4px;
  border-bottom: 2px solid var(--orange);
}

.dtwin-mon-spacer-row th {
  height: 5px;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.dtwin-mon-stage-header {
  min-width: 60px;
  max-width: 120px;
  padding: 6px 8px !important;
  vertical-align: bottom !important;
  border-radius: 5px 5px 0 0;
  border: 2px solid #E0E0E0;
  border-bottom: none;
}

.dtwin-mon-cell {
  border-left: 2px solid #E0E0E0;
  border-right: 2px solid #E0E0E0;
}

.dtwin-mon-stage-label {
  display: inline-block;
  width: 100%;
  padding: 6px 8px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.dtwin-mon-row-label {
  text-align: left !important;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-card) !important;
  padding-left: 12px !important;
  padding-right: 16px !important;
  min-width: 170px;
  position: sticky;
  left: 0;
  z-index: 2;
  border-radius: 0 !important;
}

.dtwin-mon-cell {
  min-width: 40px;
}

.dtwin-mon-duration-input {
  width: 52px;
  padding: 2px 4px;
  border: 1px solid var(--border) !important;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  background: var(--bg-input);
}

.dtwin-mon-duration-input:focus {
  outline: none;
  border-color: var(--orange) !important;
  box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.15);
}

.dtwin-mon-dur-combo {
  white-space: nowrap;
}

.dtwin-mon-dur-sep {
  margin: 0 3px;
  font-size: 11px;
}

.dtwin-mon-dur-expected {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.dtwin-mon-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--success);
  vertical-align: middle;
}

.dtwin-mon-cb-label {
  display: inline-block;
  min-width: 72px;
  vertical-align: middle;
  position: relative;
  top: 2px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1px;
}

/* Green highlight for completed stages */
.dtwin-mon-done {
  background: #2AAA8A !important;
  color: #fff !important;
}

.dtwin-mon-done .dtwin-mon-duration-input {
  background: transparent !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.4) !important;
}

.dtwin-mon-done .dtwin-mon-stage-label {
  background: transparent !important;
  border-color: transparent !important;
  color: #fff !important;
}

.dtwin-mon-done .dtwin-mon-dur-sep,
.dtwin-mon-done .dtwin-mon-dur-expected {
  color: rgba(255,255,255,0.85) !important;
}

.dtwin-mon-state-row td {
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: 0 0 5px 5px;
  border-bottom: 2px solid #E0E0E0;
}

.dtwin-mon-state-row td.dtwin-mon-row-label {
  border-radius: 0;
  border: none;
}

.dtwin-mon-prob-row td,
.dtwin-mon-prob-row td.dtwin-mon-done,
td.dtwin-mon-prob-cell,
td.dtwin-mon-prob-cell.dtwin-mon-done {
  padding-top: 5px;
  padding-bottom: 8px;
  background: transparent !important;
  background-color: transparent !important;
}

.dtwin-mon-prob-value {
  font-size: 11px;
  font-weight: 600;
}

.dtwin-mon-prob-high .dtwin-mon-prob-value {
  color: var(--success);
}

.dtwin-mon-prob-mid .dtwin-mon-prob-value {
  color: var(--orange);
}

.dtwin-mon-prob-low .dtwin-mon-prob-value {
  color: var(--danger);
}

.dtwin-monitoring-toolbar {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dtwin-mon-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Title bar: project name + stage badge --- */
.dtwin-mon-title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.dtwin-mon-title-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.dtwin-mon-stage-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--orange);
  color: #fff;
  letter-spacing: 0.3px;
}

/* --- Phase progress bar --- */
.dtwin-mon-phase-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.dtwin-mon-progress-wrap {
  position: relative;
  height: auto;
  padding: 2px 2px;
  background: rgba(0,0,0,0.08);
  border-radius: 2px;
  overflow: visible;
}

.dtwin-mon-progress-bar {
  height: 12px;
  border-radius: 2px;
  background: var(--success);
  min-width: 0;
  transition: width 0.4s ease;
  position: relative;
}

.dtwin-mon-progress-label {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.dtwin-mon-progress-label-outside {
  right: auto;
  left: 100%;
  margin-left: 4px;
  color: var(--text);
}

/* --- Variance highlighting --- */
.dtwin-mon-delay-mild {
  background: #FFF3E0 !important;
}

.dtwin-mon-delay-severe {
  background: #FFEBEE !important;
}

.dtwin-mon-ahead {
  background: #E3F2FD !important;
}

/* --- Summary content in toolbar --- */
.dtwin-mon-summary-content {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
}

/* --- Unsaved-changes indicator --- */
.dtwin-mon-unsaved-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  animation: dtwin-pulse 1.5s infinite;
  flex-shrink: 0;
}

@keyframes dtwin-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}