/* =====================================================================
   FIDEX OS — экран «Лента» (этап 0, фазы 3–4)
   Только токены из styles.css; свои переменные здесь не заводим.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Вопрос к ИИ + баннер даты
   --------------------------------------------------------------------- */

.feed-ask{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 0;
}

.feed-ask-avatar{
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  color: #fff;
}

.feed-ask-btn{
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.feed-ask-btn:active{ background: var(--surface-2); }

/* мягкая бирюзовая плашка-итог; числа внутри — жирным бирюзовым (.feed-banner-num) */
.feed-banner{
  margin: 10px 16px 4px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--teal-soft);
}
.feed-banner-summary{
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.4;
}
.feed-banner-num{
  color: var(--teal);
  font-weight: 800;
}
.feed-banner-date{
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-2xs);
}

/* ---------------------------------------------------------------------
   Фильтр-таблетки над лентой (fb-patterns §5, P1) — прилипают под шапкой;
   --fx-topbar-h ставится app.js после измерения реальной высоты .topbar,
   а при её скрытии (scroll) body получает fx-header-hidden и пилюли
   поднимаются к самому верху.
   --------------------------------------------------------------------- */

.feed-filters{
  position: sticky;
  top: var(--fx-topbar-h, 56px);
  z-index: 30;
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  background: var(--ground);
  scrollbar-width: none;
  transition: top .2s ease;
}
.feed-filters::-webkit-scrollbar{ display: none; }
body.fx-header-hidden .feed-filters{ top: 0; }

.feed-pill{
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.feed-pill.is-active{
  background: var(--teal);
  border-color: var(--teal);
  color: var(--teal-ink);
}

/* ---------------------------------------------------------------------
   Крупная цифра: число (Unbounded) + единица меньшим кеглем в одной
   строке — не переносится на 360px (правки/эскроу-приёмка).
   --------------------------------------------------------------------- */

.num-hero{
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 6px;
  white-space: nowrap;
}
.num-hero-value{ font-family: var(--font-display); }
.num-hero-unit{
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Подпись под кружком истории — перенос по словам, не по буквам (дефект
   приёмки: «darom… i»); ширина кружка (.story-ring) не меняется.
   --------------------------------------------------------------------- */

.story-label{
  white-space: normal;
  text-overflow: clip;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: calc(1.25em * 2);
}

/* Число-«герой» в карточке истории — дефект приёмки: «91,0 mln soʻm»
   вылезало за карточку 104px в один ряд. Значение и единица — двумя
   отдельными строками (22px / мелкий текст), а не рядом через пробел. */
.num-hero.story-card-hero{
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  gap: 0;
}
.story-card-hero .num-hero-value{
  font-size: 22px;
  line-height: 1.1;
}
.story-card-hero .num-hero-unit{
  display: block;
  font-size: var(--fs-2xs);
  color: rgba(255,255,255,.85);
  margin-top: 1px;
}

/* Кольцо истории — бирюзово-янтарный градиент у непросмотренной, серое у
   просмотренной в пределах сессии (fb-patterns §8). Двухслойный фон —
   padding-box (тёмная подложка внутри) + border-box (сама «рамка»). */
.story-ring{
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)) padding-box,
    linear-gradient(135deg, var(--teal), var(--amber)) border-box;
}
.story-ring.is-viewed{
  background:
    linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)) padding-box,
    rgba(255,255,255,.45) border-box;
}

/* ---------------------------------------------------------------------
   Шапка поста: круглый аватар раздела (градиент) + заголовок + мета
   --------------------------------------------------------------------- */

.fact-head{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.fact-icon{
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fact-head-text{ min-width: 0; }

.fact-title{
  font-family: var(--font-display);
  font-size: var(--fs-md);
}

.fact-meta{ font-size: var(--fs-2xs); margin-top: 1px; }

/* вывод одним предложением — сам факт, жирным */
.fact-lead{
  margin: 0 0 8px;
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.3;
}

.fact-note{ margin-top: 10px; font-size: var(--fs-xs); line-height: 1.4; }
.fact-note p{ margin: 0 0 2px; }
/* «Qadam: …» — всегда видим, не под «koʻproq» (fb-patterns §6, шаг 5) */
.fact-step{
  margin: 10px 0 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

/* разбивка по месяцам внутри раскрытого FX.seeMore (карточка «Pul») */
.fx-detail-table{
  margin-top: 8px;
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}
.fx-detail-table th{
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 3px 8px 3px 0;
}
.fx-detail-table td{ text-align: right; font-weight: 700; padding: 3px 0; }

.fact-hero{ margin: 4px 0 2px; }
.fact-compare{ font-size: var(--fs-xs); margin-bottom: 10px; }

.fact-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* карточка-переход в amoCRM в ленте */
.amo-teaser .fact-head{ margin-bottom: 0; }

.fact-illustration{
  margin: 12px 0 0;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.fact-illustration img{
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
.illustration-caption{
  padding: 8px 2px 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.illustration-credit{ padding: 2px 2px 0; }

/* ---------------------------------------------------------------------
   Столбчатый график «Pul»
   --------------------------------------------------------------------- */

.bar-chart{ margin: 8px 0 4px; }

.bar-plan-legend{
  font-size: var(--fs-2xs);
  margin-bottom: 6px;
}

.bars-frame{
  position: relative;
  height: 140px;
  margin-top: 6px;
}

.bars{
  display: flex;
  gap: 16px;
  align-items: flex-end;
  height: 100%;
}

/* строки значений/подписей столбиков «Pul» — СВОИ ряды вне bars-frame,
   чтобы пунктирная линия плана (позиционируется процентом внутри рамки)
   никогда не могла лечь на текст: у них разные системы координат. */
.bar-values-row{ margin-bottom: 6px; }
.bar-labels-row{ margin-top: 6px; }
.bar-cell{ flex: 1 1 0; text-align: center; }

.bar-col{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  height: 100%;
  justify-content: flex-end;
}

.bar-value{ font-size: var(--fs-xs); font-weight: 700; }

.bar-outer{
  width: 100%;
  max-width: 64px;
  height: 100%;
  position: relative;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.bar{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  /* ≤400мс — рост допустим только для того, что ниже первого экрана
     (см. growBar в feed.js); то, что видно в покое, получает высоту
     сразу, без transition */
  transition: height .4s ease;
}
.bar-jul{ background: color-mix(in srgb, var(--teal) 40%, var(--surface-2)); }
.bar-aug{ background: var(--teal); }

.bar-label{ font-size: var(--fs-2xs); }

.bar-plan-line{
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--amber);
}

.bar-plan-nodata{ margin-top: 10px; }

/* ---------------------------------------------------------------------
   Решения
   --------------------------------------------------------------------- */

/* дефект приёмки: заголовок + счётчик расходились на две строки —
   заголовок 17px в одну строку (усечение при нехватке места), счётчик
   мелко справа и никогда не переносится. */
.decisions-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.decisions-head > span:first-child{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.decisions-count{
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--teal);
}

.decisions-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* цветная вертикальная полоса слева: янтарная — деньги/срочно,
   бирюзовая — процесс (без денежного веса) */
.decision-card{
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 12px 12px 16px;
  background: var(--surface);
  transition: transform .25s ease, opacity .25s ease;
  touch-action: pan-y;
}
.decision-card::before{
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
}
.decision-money::before{ background: var(--amber); }
.decision-process::before{ background: var(--teal); }
.decision-card.is-leaving{
  transform: translateX(120%);
  opacity: 0;
}

.decision-title{ font-weight: 700; margin-bottom: 4px; }
.decision-why{ font-size: var(--fs-xs); margin-bottom: 8px; }

.decision-meta{
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.decision-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-hint{
  margin-top: 8px;
  font-size: var(--fs-2xs);
}

/* ---------------------------------------------------------------------
   Заголовок секции с ссылкой «yana»/«hammasi» справа (звонки, Reels,
   советы) — общий паттерн для нескольких секций ленты.
   --------------------------------------------------------------------- */

.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.section-more{
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 0;
  min-height: auto;
  color: var(--teal);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}

/* ---------------------------------------------------------------------
   Кому позвонить — горизонтальные карточки ~150px
   --------------------------------------------------------------------- */

.call-row{
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-top: 10px;
  scrollbar-width: none;
}
.call-row::-webkit-scrollbar{ display: none; }

.call-item-card{
  position: relative;
  flex: 0 0 auto;
  width: 150px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

/* «Bugun koʻrsatilmasin» — крестик в углу, People You May Know (§10) */
.call-item-close{
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.call-item-close svg{ width: 14px; height: 14px; }

.call-avatar{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--amber));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-name{ font-weight: 700; font-size: var(--fs-xs); }
.call-note{ font-size: var(--fs-2xs); flex: 1; }
.call-cta{ width: 100%; margin-top: 2px; }

/* ---------------------------------------------------------------------
   Reels — превью-ряд в ленте
   --------------------------------------------------------------------- */

.reels-row{
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.reels-row::-webkit-scrollbar{ display: none; }

.reels-cover{
  position: relative;
  flex: 0 0 auto;
  width: 120px;
  height: 200px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--surface-2);
}
.reels-cover img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reels-cover::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.65));
}
.reels-cover .reel-tag,
.reels-cover .reel-namuna{
  position: absolute;
  left: 6px;
  z-index: 2;
  font-size: 10px;
  height: 20px;
  padding: 0 8px;
}
.reels-cover-play{
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,.92);
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.reels-cover .reel-tag{ top: 6px; background: rgba(255,255,255,.85); color: var(--ink); }
.reels-cover .reel-namuna{ top: 30px; }
.reels-cover-title{
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
}

/* ---------------------------------------------------------------------
   Советы — карусель
   --------------------------------------------------------------------- */

.advice-carousel{
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.advice-carousel::-webkit-scrollbar{ display: none; }

.advice-item{
  flex: 0 0 auto;
  width: 220px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
}
.advice-item-title{ font-weight: 700; font-size: var(--fs-sm); margin-bottom: 6px; }
.advice-item ol{ margin: 0; padding-left: 18px; font-size: var(--fs-xs); color: var(--muted); }
.advice-item li + li{ margin-top: 4px; }

/* ---------------------------------------------------------------------
   Воспоминание — фото на весь пост фоном, тёмное затемнение, белый текст
   --------------------------------------------------------------------- */

.memory-card{
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
}
.memory-bg{
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.memory-card::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(10, 18, 16, .58);
}
.memory-content{ position: relative; z-index: 1; }
.memory-content .fact-title{ color: #fff; }

.memory-rows{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.memory-row{
  padding: 10px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.14);
}
.memory-label{ font-size: var(--fs-xs); color: rgba(255,255,255,.78); margin-bottom: 4px; }
.memory-values{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  flex-wrap: wrap;
  color: #fff;
}
.memory-values .muted{ color: rgba(255,255,255,.72); }
.memory-arrow{ color: rgba(255,255,255,.72); }
.memory-now{ font-weight: 700; }
.memory-source-btn{ margin-top: 8px; }
.memory-card .memory-source-btn{ color: #fff; }

/* ---------------------------------------------------------------------
   Конец ленты
   --------------------------------------------------------------------- */

.feed-end{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px 16px 32px;
  font-size: var(--fs-xs);
}
.feed-end-text{ display: flex; align-items: center; gap: 6px; }
.feed-end-text svg{ width: 16px; height: 16px; color: var(--good); }

/* ---------------------------------------------------------------------
   Истории — полноэкранный слой
   --------------------------------------------------------------------- */

.story-overlay .overlay-body.story-body{
  position: relative;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.story-image{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-image.is-animated{
  animation: story-kenburns 6s ease-in-out forwards;
}
@keyframes story-kenburns{
  from{ transform: scale(1); }
  to{ transform: scale(1.08) translateY(-1%); }
}

.story-content{
  position: relative;
  z-index: 2;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.78) 55%);
  color: #fff;
}
.story-number{ color: #fff; }
.story-compare{ font-size: var(--fs-xs); color: rgba(255,255,255,.82); margin-top: 4px; }
.story-why{ margin: 14px 0 4px; font-size: var(--fs-sm); }
.story-step{ margin: 0 0 16px; font-size: var(--fs-sm); font-weight: 700; }
.story-detail-btn{ width: 100%; }

.story-nav-btn{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  z-index: 3;
  cursor: pointer;
}
.story-nav-prev{ left: 8px; }
.story-nav-next{ right: 8px; }

/* ---------------------------------------------------------------------
   Reels — полноэкранный слой
   --------------------------------------------------------------------- */

.reels-overlay{ padding: 0; }

.reels-viewer{
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.reels-viewer::-webkit-scrollbar{ display: none; }

.reel-slide{
  position: relative;
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.reel-cover-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reel-gradient{
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.05) 38%, rgba(0,0,0,.8));
}

.reel-top{
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.reel-tag{ background: rgba(255,255,255,.2); color: #fff; }

.reel-hint{
  position: absolute;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: var(--fs-xs);
  opacity: .9;
  z-index: 2;
}

.reel-bottom{
  position: relative;
  z-index: 2;
  padding: 16px 72px calc(28px + env(safe-area-inset-bottom, 0px)) 16px;
  color: #fff;
}
.reel-title{ font-family: var(--font-display); font-size: var(--fs-md); margin-bottom: 4px; }
.reel-credit{ color: rgba(255,255,255,.78); }

.reel-actions{
  position: absolute;
  right: 10px;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}
.reel-action-btn{
  background: rgba(0,0,0,.38);
  border: none;
  color: #fff;
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 14px;
  font-size: var(--fs-xs);
  cursor: pointer;
}
.reel-action-btn.is-active{ background: var(--amber); color: var(--ink); }

.reels-close{
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 3;
}

/* Карточка истории: .story-content из полноэкранного просмотра давал ей поля 20px — подпись сжималась до 48px и рвала слово */
.story .story-content{ padding: 0; background: none; }


/* Столбики не шире экрана на 360px: колонки могут сжиматься, промежуток
   уменьшается, длинная подпись суммы переносится (проверка screens, 28.09). */
.bars{ gap: clamp(4px, 2vw, 16px); }
.bar-cell, .bar-col{ min-width: 0; }
.bar-value, .bar-label{ overflow-wrap: anywhere; line-height: 1.2; }

