@import url("tokens.css");

/* ── Base ── */
body {
  background-color: var(--color-bg);
  font-family: var(--font-family);
  color: var(--color-text);
  margin: 0;
}

Label {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ── App shell ── */
.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Collapsible top panel ── */
.app-top-panel {
  position: sticky;
  top: 0;
  z-index: 1100;
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 0;
  box-sizing: border-box;
  background: var(--color-bg);
}

.app-top-panel__body {
  overflow: hidden;
  max-height: 520px;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.2s ease, margin 0.28s ease;
}

.app-top-panel--collapsed {
  display: none;
}

.app-header {
  background: var(--color-primary);
  color: #fff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 24px;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.app-header__brand {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.app-panel-toggle {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 12px;
  flex-shrink: 0;
  box-shadow: none;
  min-height: 0;
  min-width: 0;
  width: auto;
  margin: 0;
  transition: background-color 0.15s ease;
}

.app-panel-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: none;
  box-shadow: none;
}

.app-panel-toggle--top {
  white-space: nowrap;
}

.app-header__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.02em;
}

.app-header__subtitle {
  font-size: 13px;
  opacity: 0.85;
  margin-left: 12px;
  font-weight: 400;
}

.app-main {
  flex: 1;
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 12px 24px 40px;
  box-sizing: border-box;
}

.app-root--top-collapsed .app-main {
  padding-top: 8px;
}

/* ── Toolbar ── */
.app-toolbar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.app-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

.app-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.app-toolbar__group--period {
  flex: 0 0 auto;
}

.app-toolbar__group--auth {
  flex: 1 1 280px;
  max-width: 420px;
}

.app-toolbar__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.app-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.app-toolbar__loading {
  width: 100%;
}

.app-toolbar__buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.app-toolbar__excel-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  max-width: 100%;
}

.app-toolbar__excel-label {
  white-space: nowrap;
  flex-shrink: 0;
}

.app-toolbar__cost-link {
  margin-left: auto;
  flex-shrink: 0;
}

.app-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  padding: 0 4px;
}

.app-status__item {
  margin: 0;
}

.app-status__item--warning {
  color: var(--color-warning);
  font-weight: 500;
}

#output_text {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0;
}

/* ── Inputs ── */
.app-input {
  width: 100%;
  max-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.app-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.app-input--short {
  max-width: 100px;
}

/* DatePickerRange — календарь поверх всего интерфейса */
.app-toolbar .SingleDatePickerInput,
.app-toolbar .DateRangePickerInput {
  border-radius: var(--radius-sm);
}

.app-toolbar .DateRangePicker,
.app-toolbar .SingleDatePicker {
  position: relative;
  z-index: 1;
}

.DateRangePicker_picker,
.SingleDatePicker_picker,
.DateRangePicker__picker--portal,
.SingleDatePicker__picker--portal {
  z-index: 10000 !important;
}

.DateRangePicker_picker__portal,
.SingleDatePicker_picker__portal {
  z-index: 10000 !important;
}

/* Быстрый выбор месяца / года в календаре */
.date-quick-nav {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.date-quick-nav__select {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
  appearance: auto;
}

.date-quick-nav__select:hover {
  border-color: var(--color-primary);
}

.date-quick-nav__select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* ── Buttons ── */
.app-button,
.start_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 20px;
  width: auto;
  min-width: 160px;
  max-width: 100%;
  background-color: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  margin: 0;
}

.app-button:hover,
.start_button:hover {
  background-color: var(--color-primary-dark);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.app-button:active,
.start_button:active {
  transform: translateY(0);
}

.app-button--secondary {
  background-color: var(--color-surface);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-primary);
}

.app-button--secondary:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.app-button--instr {
  min-width: 200px;
  margin-bottom: 0;
}

.app-button--sm {
  min-width: 0;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* ── Filter panel & fields ── */
.filter-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.filter-panel__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}

.filter-panel .filter-row {
  margin-top: 0;
  margin-bottom: 0;
  max-width: none;
  width: 100%;
  gap: 16px;
}

.filter-panel > .filter-field + .filter-field,
.filter-panel > .filter-row + .filter-field {
  margin-top: 12px;
}

.filter-field {
  flex: 1 1 240px;
  min-width: 200px;
}

.filter-field--wide {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}

.filter-field__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.filter-field__control {
  width: 100%;
}

.filter-field__control .app-dropdown,
.filter-field__control .Select {
  width: 100%;
}

/* ── Toggle chips (чеклист показателей) ── */
.dyn-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0;
}

.dyn-checklist .dyn-checklist__label {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  margin: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.dyn-checklist .dyn-checklist__label:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.dyn-checklist .dyn-checklist__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.dyn-checklist .dyn-checklist__label:has(.dyn-checklist__input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.dyn-checklist .dyn-checklist__label:has(.dyn-checklist__input:checked):hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.filter-panel .dyn-checklist {
  margin: 0;
}

#excel_ready_label {
  color: var(--color-success) !important;
  font-weight: 600 !important;
  font-size: 13px;
  margin: 0 !important;
}

/* ── Content area ── */
.app-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.app-workspace {
  display: flex;
  align-items: stretch;
  min-height: 520px;
}

.app-root--top-collapsed .app-main {
  padding-top: 8px;
}

.app-root--top-collapsed .app-workspace {
  min-height: calc(100vh - 80px);
}

.app-root--sidebar-collapsed .app-workspace {
  min-height: calc(100vh - 160px);
}

.app-root--top-collapsed.app-root--sidebar-collapsed .app-workspace {
  min-height: calc(100vh - 60px);
}

.app-root--top-collapsed .app-sidebar {
  max-height: calc(100vh - 80px);
}

/* ── Sidebar navigation ── */
.app-sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--color-primary);
  padding: 8px 0 16px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  transition: width 0.28s ease, padding 0.28s ease;
}

.app-sidebar--collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}

.app-root--top-collapsed .app-sidebar {
  max-height: calc(100vh - 130px);
}

.app-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 4px;
}

.app-sidebar__head-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-panel-toggle--sidebar {
  padding: 4px 8px;
  font-size: 15px;
  line-height: 1;
  border-color: rgba(255, 255, 255, 0.28);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.section-title-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.section-header .section-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
}

.product-disclaimer-wrap {
  display: none;
  flex-shrink: 0;
}

.product-disclaimer-wrap--visible {
  display: inline-flex;
}

.product-disclaimer {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.product-disclaimer__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: help;
  font-size: 12px;
  font-weight: 600;
  color: #1D4ED8;
  line-height: 1;
}

.product-disclaimer__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2563EB;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.product-disclaimer__tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1200;
  width: min(420px, 80vw);
  padding: 10px 12px;
  background: #1E3A5F;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  white-space: normal;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.product-disclaimer:hover .product-disclaimer__tooltip {
  visibility: visible;
  opacity: 1;
}

.app-view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  width: auto;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
}

.app-view-toggle:hover {
  background: var(--color-primary-light);
}

.app-root--top-collapsed .app-content-main,
.app-root--sidebar-collapsed .app-content-main {
  max-width: 100%;
}

.app-root--top-collapsed.app-root--sidebar-collapsed .app-content-main {
  padding-top: 12px;
}

.app-sidebar__group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
  padding: 12px 18px 4px;
  margin: 0;
  border: none;
}

.app-sidebar__group-title:not(:first-child) {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.app-sidebar__link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 18px;
  margin: 0;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  cursor: pointer;
  box-shadow: none;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.app-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-sidebar__link--active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
  border-left-color: #fff;
}

.app-sidebar__link--active:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.app-sidebar__link:focus,
.app-sidebar__link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: -2px;
}

.app-content-main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 32px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.3;
}

.tab-panel {
  padding-top: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#tabs_all .tab-content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Скрываем встроенную полосу вкладок Dash (#tabs_all = .tab-container) —
   навигация идёт через боковое меню, поэтому пустая панель не нужна. */
#tabs_all,
.my_tabs--sidebar.tab-container {
  display: none !important;
}

/* Контент вкладки — соседний элемент .tab-content, остаётся видимым. */
.tab-parent .tab-content,
.my_tabs--sidebar.tab-container ~ .tab-content,
#tabs_all-parent .tab-content,
.tab-content {
  display: block !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: none !important;
}


/* ── Graph rows ── */
.graph-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--color-bg);
}

.graph-row > * {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.graph-row--single {
  grid-template-columns: 1fr;
}

.graph-row--charts-tall .my_graphs {
  height: 540px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  margin-bottom: 12px;
  width: 100%;
  max-width: none;
}

.filter-row > .filter-field,
.filter-row > div {
  flex: 1 1 280px;
  min-width: 200px;
}

.my_graphs,
.big_graphs {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  height: 420px;
  background-color: var(--color-surface);
  border-radius: var(--radius-sm);
}

.graph-row .dash-graph,
.graph-row .js-plotly-plot,
.graph-row .plot-container.plotly,
.graph-row .svg-container {
  width: 100% !important;
  max-width: 100% !important;
}

/* ── KPI cards ── */
/* Тот же фрейм, что и у .graph-row ниже: рамка + padding 12px,
   чтобы карточки выравнивались по левому и правому краю с графиками. */
.kpi-dashboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 24px 0 12px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--color-bg);
}

.card_div {
  display: grid;
  border: none;
  margin: 0;
  height: auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card_div--kpi {
  display: grid !important;
  grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  margin: 0 !important;
  box-sizing: border-box;
}

.card_div--kpi > .card {
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: 0 1 auto !important;
  margin: 0 !important;
  padding: 7px 3px;
  box-sizing: border-box !important;
}

/* dbc.Card добавляет .card-body с отступами Bootstrap — убираем для KPI */
.card_div--kpi .card-body {
  padding: 0 !important;
  margin: 0;
}

.card {
  font-size: 12px;
  font-family: var(--font-family);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  height: auto;
  min-height: 74px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transform: none;
  margin-bottom: 0;
  background: var(--color-surface);
}

.card .card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--color-text);
  line-height: 1.15;
}

.card .card-text {
  font-size: 12px;
  margin: 0;
  color: rgba(26, 26, 26, 0.72);
  line-height: 1.2;
}

/* Цветовые группы KPI-карточек (как первоначально) */
.kpi-group-a { background: #9966CC; }
.kpi-group-b { background: #78DBE2; }
.kpi-group-c { background: #A8E4A0; }
.kpi-group-d { background: #FBCEB1; }
.kpi-group-e { background: #E0B8C4; }
.kpi-group-f { background: #E8D8A8; }

.kpi-group-a .card-title,
.kpi-group-a .card-text {
  color: #ffffff;
}

.card-accent-primary  { border-left: 3px solid var(--color-primary); }
.card-accent-success  { border-left: 3px solid var(--color-success); }
.card-accent-warning  { border-left: 3px solid var(--color-warning); }
.card-accent-danger   { border-left: 3px solid var(--color-danger); }
.card-accent-neutral  { border-left: 3px solid var(--color-border); }

/* ── Tables (Nepsell-style) ── */
.app-datatable,
.dash-table-stack {
  width: 100%;
  margin-bottom: 20px;
}

.app-datatable .dash-table-container,
.dash-table-stack .dash-table-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  font-family: var(--font-family);
}

/* Не создавать отдельный scrollport — fixed_rows требует overflow:hidden на контейнере */
.app-datatable .dash-scroll,
.dash-table-stack .dash-scroll {
  overflow-y: visible !important;
}

.app-datatable .dash-spreadsheet-container,
.dash-table-stack .dash-spreadsheet-container {
  border-radius: var(--radius-md);
}

.app-datatable .dash-spreadsheet-inner table,
.dash-table-stack .dash-spreadsheet-inner table {
  border-collapse: separate;
  border-spacing: 0;
}

/* Шапка — без position:sticky (даёт синюю полосу над заголовками) */
.app-datatable .dash-header,
.dash-table-stack .dash-header {
  background-color: var(--table-header-bg) !important;
  box-sizing: border-box;
}

.app-datatable .dash-fixed-content .dash-header .dash-header-cell,
.app-datatable .dash-fixed-content .dash-header th,
.app-datatable .dash-scroll .dash-header .dash-header-cell,
.app-datatable .dash-scroll .dash-header th,
.dash-table-stack .dash-fixed-content .dash-header .dash-header-cell,
.dash-table-stack .dash-fixed-content .dash-header th,
.dash-table-stack .dash-scroll .dash-header .dash-header-cell,
.dash-table-stack .dash-scroll .dash-header th,
.app-datatable .dash-header [role="columnheader"],
.dash-table-stack .dash-header [role="columnheader"] {
  box-sizing: border-box !important;
  padding: 8px 10px !important;
  overflow: hidden !important;
  vertical-align: middle !important;
  background-color: var(--table-header-bg) !important;
  color: var(--table-header-text) !important;
  min-width: var(--table-min-col-width) !important;
}

.app-datatable .dash-fixed-content .dash-header .dash-header-cell,
.app-datatable .dash-fixed-content .dash-header th,
.dash-table-stack .dash-fixed-content .dash-header .dash-header-cell,
.dash-table-stack .dash-fixed-content .dash-header th {
  z-index: 92 !important;
}

.app-datatable .dash-header .column-header,
.dash-table-stack .dash-header .column-header {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  overflow: hidden;
}

/* Строка native-фильтров скрыта — фильтр через кнопку в шапке (table_excel_filter.js) */
.app-datatable .dash-filter,
.dash-table-stack .dash-filter {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.table-excel-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  box-shadow: none; /* глобальная тень button на тёмной шапке даёт светлый квадрат */
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.table-excel-filter-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.table-excel-filter-btn--active {
  background: rgba(255, 255, 255, 0.22);
  color: #FFD166; /* активный фильтр заметен на тёмной шапке */
}

/* Явный display: в assets живёт legacy-правило Button{display:none}
   (styles-checkpoint.css), без этого кнопки попапа невидимы. */
.table-excel-filter-popup button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  margin: 0;
  box-shadow: none;
}

.table-excel-filter-popup {
  position: fixed;
  z-index: 13000;
  min-width: 220px;
  max-width: min(320px, 92vw);
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--table-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-family: var(--font-family);
  font-size: 13px;
}

.table-excel-filter-popup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--table-border);
}

.table-excel-filter-popup__title {
  font-weight: 600;
  color: var(--color-text);
}

.table-excel-filter-popup__close {
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 4px;
}

.table-excel-filter-popup__search {
  margin: 8px 10px 0;
  padding: 7px 10px;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}

.table-excel-filter-popup__search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.table-excel-filter-popup__num {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--table-border);
}

.table-excel-filter-popup__num-hint {
  font-size: 11px;
  color: var(--color-text-muted);
}

.table-excel-filter-popup__num-row {
  display: flex;
  gap: 6px;
}

.table-excel-filter-popup__num-row select {
  flex: 0 0 118px;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 12px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.table-excel-filter-popup__num-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
}

.table-excel-filter-popup__num-row input:focus,
.table-excel-filter-popup__num-row select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.table-excel-filter-popup__actions {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
}

.table-excel-filter-popup__actions button {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.table-excel-filter-popup__actions button:hover {
  text-decoration: underline;
}

.table-excel-filter-popup__list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  min-height: 80px;
  max-height: 240px;
}

.table-excel-filter-popup__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.3;
}

.table-excel-filter-popup__item:hover {
  background: var(--table-row-hover);
}

.table-excel-filter-popup__item span {
  flex: 1;
  word-break: break-word;
}

.table-excel-filter-popup__empty {
  padding: 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
}

.table-excel-filter-popup__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--table-border);
  flex-shrink: 0; /* кнопки ОК/Отмена не должны обрезаться при высоком списке */
}

.table-excel-filter-popup__head,
.table-excel-filter-popup__search,
.table-excel-filter-popup__num,
.table-excel-filter-popup__actions {
  flex-shrink: 0;
}

.table-excel-filter-popup__apply,
.table-excel-filter-popup__cancel {
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.table-excel-filter-popup__apply {
  border: none;
  background: var(--color-primary);
  color: #fff;
}

.table-excel-filter-popup__cancel {
  border: 1px solid var(--table-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.app-datatable .dash-filter tr,
.dash-table-stack .dash-filter tr {
  height: 0 !important;
}

.app-datatable .dash-filter .dash-filter-cell,
.dash-table-stack .dash-filter .dash-filter-cell {
  display: none !important;
}

.app-datatable .dash-header .column-header-name,
.dash-table-stack .dash-header .column-header-name {
  color: var(--table-header-text) !important;
  white-space: pre-line !important;
  line-height: 1.2;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-align: center;
  width: 100%;
}

.app-datatable .dash-header .column-actions,
.dash-table-stack .dash-header .column-actions {
  color: rgba(255, 255, 255, 0.75) !important;
}

.app-datatable .dash-header .column-header--sort,
.dash-table-stack .dash-header .column-header--sort {
  color: var(--table-header-text) !important;
}

/* Строка фильтров */
.app-datatable .dash-filter,
.dash-table-stack .dash-filter {
  background: var(--table-filter-bg) !important;
}

.app-datatable .dash-filter input,
.dash-table-stack .dash-filter input {
  border-radius: 6px !important;
  border: 1px solid var(--table-border) !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-family: var(--font-family) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-datatable .dash-filter input:focus,
.dash-table-stack .dash-filter input:focus {
  outline: none !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-light) !important;
}

/* Тело таблицы — зебра и hover */
.app-datatable .dash-spreadsheet-inner tr:nth-child(even) td,
.dash-table-stack .dash-spreadsheet-inner tr:nth-child(even) td {
  background-color: var(--table-row-zebra);
}

.app-datatable .dash-spreadsheet-inner tr:hover td,
.dash-table-stack .dash-spreadsheet-inner tr:hover td {
  background-color: var(--table-row-hover) !important;
}

/* Пагинация */
.app-datatable .previous-next-container,
.dash-table-stack .previous-next-container {
  padding: 10px 12px 14px;
  font-family: var(--font-family);
}

.app-datatable .previous-next-container button,
.dash-table-stack .previous-next-container button {
  border: 1px solid var(--table-border) !important;
  border-radius: 8px !important;
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  margin: 0 4px !important;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.app-datatable .previous-next-container button:hover:not(:disabled),
.dash-table-stack .previous-next-container button:hover:not(:disabled) {
  background: var(--color-primary-light) !important;
  border-color: var(--color-primary) !important;
  color: var(--color-primary-dark) !important;
}

.app-datatable .previous-next-container button:disabled,
.dash-table-stack .previous-next-container button:disabled {
  opacity: 0.45;
  cursor: default;
}

.app-datatable .page-number,
.dash-table-stack .page-number {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Закреплённые столбцы (fixed_columns) — шапка, фильтры и данные синхронно */
.app-datatable .dash-fixed-column,
.dash-table-stack .dash-fixed-column {
  z-index: 2;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.06);
}

.app-datatable .dash-header .dash-fixed-column,
.dash-table-stack .dash-header .dash-fixed-column {
  z-index: 6;
  background-color: var(--table-header-bg) !important;
  color: var(--table-header-text) !important;
}

.app-datatable .dash-header .dash-fixed-column .column-header-name,
.dash-table-stack .dash-header .dash-fixed-column .column-header-name {
  color: var(--table-header-text) !important;
}

.app-datatable .dash-filter .dash-fixed-column,
.dash-table-stack .dash-filter .dash-fixed-column {
  z-index: 5;
  background-color: var(--table-filter-bg) !important;
}

.app-datatable .dash-fixed-content .dash-fixed-column,
.dash-table-stack .dash-fixed-content .dash-fixed-column {
  background-color: var(--color-surface);
}

.app-datatable .dash-spreadsheet-inner tr:nth-child(even) .dash-fixed-column,
.dash-table-stack .dash-spreadsheet-inner tr:nth-child(even) .dash-fixed-column {
  background-color: var(--table-row-zebra);
}

.app-datatable .dash-spreadsheet-inner tr:hover .dash-fixed-column,
.dash-table-stack .dash-spreadsheet-inner tr:hover .dash-fixed-column {
  background-color: var(--table-row-hover) !important;
}

.app-datatable .dash-fixed-row .dash-fixed-column,
.dash-table-stack .dash-fixed-row .dash-fixed-column {
  background-color: var(--table-total-bg) !important;
}

/* Закреплённая строка «Итого» (fixed_rows) */
.app-datatable .dash-fixed-content .dash-fixed-row,
.dash-table-stack .dash-fixed-content .dash-fixed-row,
.app-datatable .dash-fixed-row,
.dash-table-stack .dash-fixed-row {
  visibility: visible !important;
  background-color: var(--table-total-bg) !important;
  font-weight: 600;
  border-bottom: 2px solid var(--table-border) !important;
}

.app-datatable .dash-fixed-row td,
.dash-table-stack .dash-fixed-row td {
  background-color: var(--table-total-bg) !important;
}

/* Tooltip для обрезанного текста в ячейках (table_text_tooltip.js) */
.table-text-tooltip {
  display: none;
  position: fixed;
  z-index: 12000;
  max-width: min(420px, 90vw);
  padding: 8px 12px;
  background: var(--color-text);
  color: #fff;
  font-family: var(--font-family);
  font-size: 12px;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Dropdowns (react-select v1 + v5) ── */
.app-dropdown {
  width: 100%;
  font-family: var(--font-family);
  font-size: 13px;
}

/* Legacy react-select */
.app-dropdown .Select-control,
.tab-panel .Select-control {
  min-height: 40px !important;
  border-radius: 10px !important;
  border: 1px solid var(--color-border) !important;
  background: var(--color-surface) !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-dropdown .Select-control:hover,
.tab-panel .Select-control:hover {
  border-color: #c5cad0 !important;
}

.app-dropdown .Select.is-focused > .Select-control,
.app-dropdown .Select.is-open > .Select-control,
.tab-panel .Select.is-focused > .Select-control {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-light) !important;
}

.app-dropdown .Select-placeholder,
.app-dropdown .Select-value-label,
.app-dropdown .Select-input > input,
.tab-panel .Select-value-label {
  color: var(--color-text) !important;
  font-size: 13px !important;
}

.app-dropdown .Select-placeholder,
.tab-panel .Select-placeholder {
  color: var(--color-text-muted) !important;
}

.app-dropdown .Select-menu-outer,
.tab-panel .Select-menu-outer {
  border-radius: 10px !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: var(--shadow-md) !important;
  margin-top: 4px !important;
  overflow: hidden;
  background: var(--color-surface) !important;
  z-index: 1200 !important;
}

.app-dropdown .Select-option,
.tab-panel .Select-option {
  color: var(--color-text) !important;
  font-size: 13px !important;
  padding: 10px 12px !important;
}

.app-dropdown .Select-option.is-focused,
.tab-panel .Select-option.is-focused {
  background: var(--color-primary-light) !important;
  color: var(--color-primary-dark) !important;
}

.app-dropdown .Select-option.is-selected,
.tab-panel .Select-option.is-selected {
  background: var(--color-primary) !important;
  color: #fff !important;
}

.app-dropdown .Select-value,
.app-dropdown .Select-value-icon {
  border-color: rgba(75, 144, 114, 0.25) !important;
}

.app-dropdown--multi .Select-value {
  background: var(--color-primary-light) !important;
  border-radius: 999px !important;
  border: none !important;
  color: var(--color-primary-dark) !important;
  margin: 3px 4px 3px 0 !important;
}

.app-dropdown--multi .Select-value-icon {
  border-right: 1px solid rgba(75, 144, 114, 0.2) !important;
  border-radius: 999px 0 0 999px !important;
}

.app-dropdown--multi .Select-value-icon:hover,
.app-dropdown--multi .Select-value-icon:focus {
  background: var(--color-primary) !important;
  color: #fff !important;
}

/* react-select v5 (Dash 3 async-dropdown) */
.app-dropdown [class*="-control"],
.tab-panel [class*="-control"] {
  min-height: 40px !important;
  border-radius: 10px !important;
  border-color: var(--color-border) !important;
  background: var(--color-surface) !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-dropdown [class*="-control"]:hover {
  border-color: #c5cad0 !important;
}

.app-dropdown [class*="-control"][class*="-focused"],
.app-dropdown [class*="-control"][class*="-menu-is-open"] {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-light) !important;
}

.app-dropdown [class*="-placeholder"],
.app-dropdown [class*="-singleValue"],
.app-dropdown [class*="-Input"] input {
  font-size: 13px !important;
  color: var(--color-text) !important;
}

.app-dropdown [class*="-placeholder"] {
  color: var(--color-text-muted) !important;
}

.app-dropdown [class*="-menu"] {
  border-radius: 10px !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: var(--shadow-md) !important;
  overflow: hidden;
  z-index: 1200 !important;
}

.app-dropdown [class*="-option"] {
  font-size: 13px !important;
  padding: 10px 12px !important;
  cursor: pointer;
}

.app-dropdown [class*="-option"][class*="-focused"] {
  background: var(--color-primary-light) !important;
  color: var(--color-primary-dark) !important;
}

.app-dropdown [class*="-option"][class*="-selected"] {
  background: var(--color-primary) !important;
  color: #fff !important;
}

.app-dropdown--multi [class*="-multiValue"] {
  background: var(--color-primary-light) !important;
  border-radius: 999px !important;
}

.app-dropdown--multi [class*="-multiValueLabel"] {
  color: var(--color-primary-dark) !important;
  font-size: 12px !important;
  font-weight: 500;
  padding: 2px 4px 2px 8px !important;
}

.app-dropdown--multi [class*="-multiValueRemove"]:hover {
  background: var(--color-primary) !important;
  color: #fff !important;
  border-radius: 0 999px 999px 0 !important;
}

.app-dropdown [class*="-indicatorSeparator"] {
  background: var(--color-border) !important;
}

.app-dropdown [class*="-indicatorContainer"] {
  color: var(--color-text-muted) !important;
}

.app-dropdown [class*="-indicatorContainer"]:hover {
  color: var(--color-primary) !important;
}

/* ── Таблица со строкой «Итого», закреплённой сверху ── */
.dash-table-stack {
  width: 100%;
  margin-bottom: 20px;
}
.photo-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
}

.product-photo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--table-border);
  background: var(--color-surface);
}

/* ── Loading overlay ── */
.app-loading-wrapper {
  min-height: 48px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .graph-row {
    grid-template-columns: 1fr;
  }

  .graph-row--charts-tall .my_graphs {
    height: 460px;
  }

  .my_graphs,
  .big_graphs {
    height: 380px;
  }

  .app-workspace {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    max-height: none;
    padding-bottom: 8px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .app-content-main {
    padding: 16px;
  }

  .app-main {
    padding: 12px 12px 32px;
  }

  .app-toolbar {
    padding: 16px;
  }

  .app-content {
    padding: 16px;
  }

  .app-button,
  .start_button {
    width: 100%;
    min-width: 0;
  }

  .app-toolbar__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .app-toolbar__buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .app-toolbar__cost-link {
    margin-left: 0;
    width: 100%;
  }

  .card_div--kpi {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
  }

  .card {
    min-height: 58px;
    padding: 5px 2px;
  }

  .card .card-title {
    font-size: 12px;
  }

  .card .card-text {
    font-size: 8px;
  }
}

/* asset-version: charts-tall-wf-1 */

.forecast-formula {
  margin: 8px 0 12px;
  width: 100%;
}

.forecast-formula__title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.forecast-formula__type {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.forecast-formula__math {
  background: #f4f6f9;
  border-radius: 8px;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 16px;
}

.forecast-formula__math .MathJax {
  font-size: 115% !important;
}

.forecast-formula__quality {
  margin-top: 10px;
  padding: 10px 14px;
  background: #eef3fa;
  border-left: 3px solid var(--color-primary, #4A6FA5);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
}

.forecast-formula__legend-title {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.forecast-formula__legend {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.55;
  color: #555;
}

.forecast-formula__coef-stats {
  margin: 6px 0 0;
  padding: 10px 14px 10px 28px;
  background: #f8f9fb;
  border-left: 3px solid #8fa8c8;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.55;
  color: #444;
}

#forecast_factor_x_table {
  min-height: 120px;
}

.forecast-season-row {
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
