/* Единый график CFPRO. Стили общие для страницы выпуска, страницы фонда,
   страницы акции и попапа скринера - разница только в модификаторе .cfc--compact.
   Цвета берутся из токенов портала, поэтому тёмная тема работает без отдельных
   правил: холст перекрашивается из JS, обвязка - переменными. */

.cfc {
  --cfc-gap: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--cfc-gap);
  min-width: 0;
  color: var(--ink, #0c0c0e);
  font-variant-numeric: tabular-nums;
}

/* ---------- шапка ---------- */
.cfc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.cfc-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.cfc-sub {
  margin: 4px 0 0;
  color: var(--g500, #676b73);
  font-size: 12.5px;
  font-weight: 600;
}
.cfc-quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-left: auto;
  text-align: right;
}
.cfc-quote-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
/* Цена облигации в рублях: тише процента, но читаемо - это ответ на вопрос
   «сколько платить», а процент от номинала на него не отвечает. */
.cfc-money {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--g700, #4a4d54);
  font-size: 14px;
  font-weight: 700;
}
.cfc-money small {
  color: var(--g500, #676b73);
  font-size: 11px;
  font-weight: 600;
}
.cfc-last {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
}
.cfc-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.cfc-delta small {
  color: var(--g500, #676b73);
  font-size: 11px;
  font-weight: 600;
}
.cfc-delta.up { color: var(--up, #147a42); }
.cfc-delta.down { color: var(--down, #c8362a); }
.cfc-delta.flat { color: var(--g500, #676b73); }

/* ---------- панель управления ---------- */
.cfc-bar {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}
.cfc-bar .cfc-tools { margin-left: auto; }

/* Слева объект - название и цена одной группой, справа управление.
   Отдельной строки под котировку больше нет: она съедала высоту и разрывала
   подпись с числом на два края панели. */
.cfc-lead {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  margin: 0 8px 0 0;
}
.cfc-lead h2, .cfc-lead h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.cfc-lead p { display: none; }
.cfc-lead .cfc-quote,
.cfc-quote.cfc-lead {
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  text-align: left;
}
.cfc-lead .cfc-quote-main, .cfc-quote.cfc-lead .cfc-quote-main { gap: 9px; }
.cfc-lead .cfc-money, .cfc-quote.cfc-lead .cfc-money { font-size: 13px; }
.cfc-lead .cfc-last, .cfc-quote.cfc-lead .cfc-last { font-size: 24px; }

.cfc-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--g100, #eef0f3);
}
.cfc-seg button {
  min-width: 34px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--g500, #676b73);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  transition: color .14s ease, background-color .14s ease;
}
.cfc-seg button:hover:not([aria-pressed="true"]):not(:disabled) { color: var(--ink, #0c0c0e); }
.cfc-seg button[aria-pressed="true"] {
  background: var(--white, #fff);
  color: var(--blue, #2f6df0);
  box-shadow: 0 1px 2px rgba(12, 12, 14, .1);
}
.cfc-seg button:disabled { opacity: .38; cursor: not-allowed; }

/* Периоды на телефоне уезжают вбок, а не переносятся на вторую строку:
   так остаётся видно, что список длиннее экрана. */
.cfc-ranges {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.cfc-ranges::-webkit-scrollbar { display: none; }

.cfc-tools { display: inline-flex; gap: 4px; }
.cfc-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--g500, #676b73);
  cursor: pointer;
  transition: color .14s ease, background-color .14s ease;
}
.cfc-icon:hover, .cfc-icon[aria-expanded="true"] {
  background: var(--g100, #eef0f3);
  color: var(--ink, #0c0c0e);
}
.cfc-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.cfc :where(button):focus-visible { outline: 3px solid var(--blue, #2f6df0); outline-offset: 2px; }

/* ---------- меню настроек ---------- */
.cfc-menu {
  position: absolute;
  z-index: 30;
  top: 0;
  right: 0;
  min-width: 210px;
  padding: 7px;
  border: 1px solid var(--g200, #e3e6ea);
  border-radius: 13px;
  background: var(--white, #fff);
  box-shadow: 0 14px 34px rgba(12, 12, 14, .16);
}
.cfc-menu[hidden] { display: none; }
.cfc-menu label, .cfc-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.cfc-menu label:hover, .cfc-menu button:hover { background: var(--g100, #eef0f3); }
.cfc-menu input { width: 15px; height: 15px; accent-color: var(--blue, #2f6df0); }

/* ---------- холст ---------- */
.cfc-body {
  position: relative;
  min-width: 0;
}
.cfc-panes { width: 100%; }
.cfc-panes canvas { display: block; }

/* Библиотека верстает себя таблицей, а на портале есть общие правила для
   таблиц - в том числе `th, td { padding: 10px 12px !important }` на телефоне.
   Из-за них холст сжимался в узкую полосу у правого края. Библиотека
   рассчитывает на поведение таблицы по умолчанию, поэтому проще вернуть
   браузерные значения целиком, а не перечислять свойства по одному. */
.cfc table, .cfc thead, .cfc tbody, .cfc tr, .cfc td, .cfc th { all: revert; }
.cfc td, .cfc th { padding: 0 !important; }

.cfc-tip {
  position: absolute;
  z-index: 12;
  top: 0;
  left: 0;
  min-width: 132px;
  padding: 9px 11px;
  border: 1px solid var(--g200, #e3e6ea);
  border-radius: 11px;
  background: var(--white, #fff);
  box-shadow: 0 10px 26px rgba(12, 12, 14, .14);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .12s ease, transform .12s cubic-bezier(.16, 1, .3, 1);
}
.cfc-tip.on { opacity: 1; transform: none; }
.cfc-tip-when {
  margin-bottom: 5px;
  color: var(--g500, #676b73);
  font-size: 11px;
  font-weight: 700;
}
.cfc-tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}
.cfc-tip-row span { color: var(--g500, #676b73); font-weight: 600; }
.cfc-tip-row b { font-weight: 800; }
.cfc-tip-row.dim b { font-weight: 700; color: var(--g700, #4a4d54); }

/* ---------- дорожка событий ---------- */
.cfc-lane {
  position: relative;
  height: 30px;
  border-top: 1px solid var(--g200, #e3e6ea);
}
.cfc-lane[hidden] { display: none; }
.cfc-ev {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin: -10px 0 0 -10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue, #2f6df0);
  color: #fff;
  cursor: pointer;
  transition: transform .14s cubic-bezier(.16, 1, .3, 1);
}
.cfc-ev:hover, .cfc-ev[aria-expanded="true"] { transform: scale(1.18); }
.cfc-ev b {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}
.cfc-ev-n {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--ink, #0c0c0e);
  color: var(--white, #fff);
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
}

.cfc-pop {
  position: absolute;
  z-index: 20;
  bottom: 30px;
  min-width: 186px;
  max-width: 262px;
  padding: 11px 13px;
  border: 1px solid var(--g200, #e3e6ea);
  border-radius: 12px;
  background: var(--white, #fff);
  box-shadow: 0 12px 30px rgba(12, 12, 14, .16);
  font-size: 12px;
  line-height: 1.5;
}
.cfc-pop[hidden] { display: none; }
.cfc-pop h4 { margin: 0 0 3px; font-size: 12.5px; font-weight: 800; }
.cfc-pop p { margin: 0; color: var(--g700, #4a4d54); }
.cfc-pop-date { margin-top: 3px; color: var(--g500, #676b73); font-weight: 600; }
.cfc-pop-item + .cfc-pop-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--g100, #eef0f3); }

/* ---------- фильтры событий ---------- */
.cfc-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cfc-filters[hidden] { display: none; }
.cfc-filters::-webkit-scrollbar { display: none; }
.cfc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid var(--g200, #e3e6ea);
  border-radius: 999px;
  background: var(--white, #fff);
  color: var(--g700, #4a4d54);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background-color .14s ease;
}
.cfc-chip:hover { color: var(--ink, #0c0c0e); }
.cfc-chip[aria-pressed="true"] {
  border-color: var(--blue, #2f6df0);
  background: var(--blue-soft, #eef4fe);
  color: var(--blue, #2f6df0);
}
.cfc-chip i {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue, #2f6df0);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
}

/* ---------- навигатор ---------- */
.cfc-nav {
  position: relative;
  border: 1px solid var(--g200, #e3e6ea);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
}
.cfc-nav[hidden] { display: none; }
.cfc-nav-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--g50, #f6f7f9);
  opacity: .82;
  pointer-events: none;
}
.cfc-nav-win {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--blue, #2f6df0);
  border-right: 1px solid var(--blue, #2f6df0);
  cursor: grab;
}
.cfc-nav-win:active { cursor: grabbing; }
.cfc-nav-h {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 26px;
  margin-top: -13px;
  border-radius: 4px;
  background: var(--blue, #2f6df0);
  cursor: ew-resize;
}
.cfc-nav-h::after {
  content: "";
  position: absolute;
  inset: 7px 3px;
  border-left: 1px solid rgba(255, 255, 255, .75);
  border-right: 1px solid rgba(255, 255, 255, .75);
}
.cfc-nav-h.l { left: -5px; }
.cfc-nav-h.r { right: -5px; }

/* ---------- состояния ---------- */
.cfc-state {
  display: grid;
  place-items: center;
  padding: 26px 18px;
  color: var(--g500, #676b73);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.cfc-state button {
  margin-top: 11px;
  padding: 8px 15px;
  border: 1px solid var(--g300, #c9cdd3);
  border-radius: 10px;
  background: var(--white, #fff);
  color: var(--ink, #0c0c0e);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.cfc-state button:hover { border-color: var(--g500, #676b73); }

/* Скелет вместо пустого белого блока: держит высоту и не мигает спиннером. */
.cfc-skel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--g50, #f6f7f9);
}
.cfc-skel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--g100, #eef0f3), transparent);
  transform: translateX(-100%);
  animation: cfc-shimmer 1.5s ease-in-out infinite;
}
.cfc-skel svg { position: relative; display: block; width: 100%; height: 100%; }
.cfc-skel path { fill: none; stroke: var(--g200, #e3e6ea); stroke-width: 2; }
@keyframes cfc-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .cfc-skel::before { animation: none; }
  .cfc *, .cfc *::before { transition-duration: .01ms !important; }
}

/* ---------- полный экран ---------- */
.cfc:fullscreen {
  padding: 22px 26px;
  background: var(--white, #fff);
}
.cfc:fullscreen .cfc-body { flex: 1 1 auto; }

/* ---------- компактный вариант для попапа ---------- */
.cfc--compact { --cfc-gap: 10px; }
.cfc--compact .cfc-name { font-size: 16px; }
.cfc--compact .cfc-last { font-size: 20px; }
.cfc--compact .cfc-lane { height: 26px; }
.cfc--compact .cfc-ev { width: 19px; height: 19px; margin: -9px 0 0 -9px; }
/* В попапе ширины меньше: без пояснений «за день» и «за облигацию» строка
   помещается целиком, а без них инструменты падали на вторую строку. */
.cfc--compact .cfc-delta small,
.cfc--compact .cfc-money small { display: none; }
.cfc--compact .cfc-lead .cfc-last { font-size: 22px; }
.cfc--compact .cfc-bar { gap: 8px 10px; }

@media (max-width: 700px) {
  .cfc-last { font-size: 22px; }
  .cfc-name { font-size: 17px; }
  .cfc-bar { gap: 8px 10px; }
  /* Объект занимает первую строку целиком, управление делит вторую:
     периоды прокручиваются вбок, иконки прижаты справа и не сжимаются. */
  .cfc-lead { flex: 1 1 100%; flex-wrap: wrap; gap: 4px 10px; margin-right: 0; }
  .cfc-lead h2, .cfc-lead h3 { font-size: 15px; }
  .cfc-lead .cfc-last, .cfc-quote.cfc-lead .cfc-last { font-size: 22px; }
  .cfc-metrics { order: 1; }
  .cfc-ranges { order: 2; flex: 1 1 auto; min-width: 0; }
  .cfc-tools { order: 3; flex: 0 0 auto; margin-left: auto; }
}
