/* =========================================
   Brand page only (scoped, no global leaks)
   Used by /brand/:slug template
   ========================================= */

/* --- Brand header tweaks --- */
.brand-header h1{ padding-bottom:0; }

/* --- Brand description typography --- */
.brand-desc{ line-height:1.55; }
.brand-desc .brand-sub{ font-size:1.05rem; margin:14px 0 8px; font-weight:600; }
.brand-desc p{ margin:0 0 10px; }

/* --- Brand fundamentals block --- */
.brand-fundamentals{ padding:14px 16px; }
.brand-fundamentals .card-title{
  margin:0 0 10px;
  font-size:15.5px;
  font-weight:800;
  letter-spacing:-0.01em;
}

.brand-fundamentals-list{
  margin:0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:10px;
}
@media (max-width:980px){
  .brand-fundamentals-list{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width:520px){
  .brand-fundamentals-list{ grid-template-columns:1fr; }
}

.brand-fundamentals-list .bf-row{
  border:1px solid var(--border);
  background: rgba(255,255,255,.85);
  border-radius:12px;
  padding:10px 10px 9px;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.brand-fundamentals-list dt{
  margin:0;
  color: var(--muted);
  font-size:12.5px;
  line-height:1.25;
}
.brand-fundamentals-list dd{
  margin:0;
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:8px;
  color: rgba(11,18,32,.92);
  font-weight:850;
  font-size:16px;
  letter-spacing:-0.01em;
}
.brand-forecast-impact{
  padding:14px 16px;
  margin:12px 0;
}

.brand-forecast-impact-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}

.brand-forecast-impact-head .card-title{
  margin:0;
}

.brand-forecast-impact-line{
  color:#475569;
  font-size:14px;
  margin-bottom:10px;
}

.brand-forecast-impact-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}

.brand-forecast-impact-grid > div{
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
}

.brand-forecast-impact-grid span{
  display:block;
  color:#64748b;
  font-size:12px;
  margin-bottom:4px;
}

.brand-forecast-impact-grid b{
  display:block;
  color:#111827;
  font-size:15px;
}

.brand-forecast-impact-grid em{
  display:block;
  color:#64748b;
  font-style:normal;
  font-size:12px;
  margin-top:4px;
}

@media (max-width: 720px){
  .brand-forecast-impact-grid{
    grid-template-columns:1fr;
  }
}
.bf-flag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:22px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:12px;
  font-weight:800;
  line-height:1;
  color: rgba(11,18,32,.82);
  background:#fff;
}
.bf-flag.good{
  color:#15803d;
  border-color: rgba(21,128,61,.22);
  background: rgba(21,128,61,.08);
}
.bf-flag.bad{
  color:#b91c1c;
  border-color: rgba(185,28,28,.22);
  background: rgba(185,28,28,.08);
}
.bf-flag.neutral{
  color:#6b7280;
  border-color: rgba(107,114,128,.22);
  background: rgba(107,114,128,.08);
}

.bf-note{
  font-size:12px;
  font-weight:650;
  color: rgba(100,116,139,.95);
  padding-left:8px;
  border-left:1px solid rgba(15,23,42,.10);
}

.brand-fundamentals-updated{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(15,23,42,.08);
  color: var(--muted);
  font-size:12.5px;
}
.brand-fundamentals-updated span{
  font-weight:750;
  color: rgba(11,18,32,.78);
}

/* --- AI rationale (brand) --- */
.brand-ai-rationale{
  margin:12px 0 0;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:14px;
  background: linear-gradient(90deg, rgba(29,78,216,.06), rgba(255,255,255,0));
  border-left:4px solid rgba(29,78,216,.35);
}
.brand-ai-rationale-label{
  font-weight:850;
  margin:0 0 6px;
  color: rgba(11,18,32,.92);
}
.brand-ai-rationale-text{
  margin:0;
  color: rgba(11,18,32,.88);
  line-height:1.6;
}

/* --- Reco events table (brand) --- */
.reco-table-wrap{ margin-top:12px; }
.reco-table-title{ font-weight:800; margin:10px 0 8px; }

.reco-table-scroll{ overflow:auto; }

.reco-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:#fff;
  border:1px solid rgba(15,23,42,.10);
  border-radius:16px;
  overflow:hidden;
  min-width:520px; /* чтобы на узких экранах был горизонтальный скролл */
}

.reco-table thead th{
  font-weight:600;
  color:#64748b;
  background:#f8fafc;
  border-bottom:1px solid rgba(15,23,42,.10);
  padding:10px 12px;
  font-size:.95rem;
  white-space:nowrap;
  text-align:left;
}

.reco-table tbody td{
  padding:12px;
  border-bottom:1px solid rgba(15,23,42,.08);
  vertical-align:top;
}
.reco-table tbody tr:last-child td{ border-bottom:none; }
.reco-table tbody tr:hover td{ background:rgba(47,107,255,.06); }

.reco-table td.mono{
  font-variant-numeric: tabular-nums;
  font-feature-settings:"tnum" 1;
  white-space:nowrap;
}
.reco-reason{ min-width:260px; }

/* Мобильный фикс: скрываем “Причина” */
@media (max-width:640px){
  .reco-table{ min-width:0; }
  .reco-table thead th:last-child,
  .reco-table td.reco-reason{ display:none; }
}

/* ===== Brand: portfolio track block ===== */

/* верхняя строка "В портфеле..." */
#pf-pos{
  margin: 8px 0 12px !important;
  color: var(--muted);
}

/* форма добавления */
#pf-add{
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 10px;
}

#pf-add label{
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  color: rgba(11,18,32,.82);
}

#pf-add label span{
  line-height: 1.1;
  font-weight: 700;
}

/* поля */
#pf-add input{
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.14);
  padding: 0 12px;
  outline: none;
  background: #fff;
  min-width: 0;
}

#pf-add input:focus{
  border-color: rgba(47,107,255,.55);
  box-shadow: 0 0 0 4px rgba(47,107,255,.14);
}

/* кнопка — на одной линии с полями */
#pf-add .btn{
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  white-space: nowrap;
}

/* сообщение справа/под формой */
#pf-add-msg{
  grid-column: 1 / -1;
  margin: 0 !important;
}

/* блок с кнопкой удаления */
#pf-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

#pf-actions .btn{
  height: 40px;
}

/* mobile: 2 поля в строку, кнопка на всю ширину */
@media (max-width: 560px){
  #pf-add{
    grid-template-columns: 1fr 1fr;
  }
  #pf-add .btn{
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
}
.reco-toggle-btn ,#toggleAnalystEvents{
  margin-top: 10px;
}
.brand-chart-legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px 14px;
  align-items:center;
  margin:10px 0 4px;
  color:#64748b;
  font-size:13px;
}

.brand-chart-legend span{
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.legend-shape,
.legend-color{
  display:inline-block;
  width:11px;
  height:11px;
  flex:0 0 auto;
}

.legend-square{
  background:#CCC;
  border-radius:2px;
}

.legend-circle{
  background:#CCC;
  border-radius:50%;
}

.legend-triangle{
  width:0;
  height:0;
  border-left:6px solid transparent;
  border-right:6px solid transparent;
  border-bottom:11px solid #CCC;
}

.legend-green,
.legend-red,
.legend-orange{
  position:relative;
  width:10px;
  height:10px;
  transform:rotate(45deg);
  border-radius:2px;
}

.legend-blue{
  background:#0ea5e9;
}

.legend-green{
  background:#16a34a;
}

.legend-red{
  background:#ef4444;
}

.legend-orange{
  background:#f59e0b;
}

/* Brand catalog filter chips */
.chips .chip-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.chips button.chip-filter {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.chips button.chip-filter:hover {
  background: #f8fafc;
}

.chips button.chip-filter:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

/* User trade markers in brand price chart legend */
.legend-trade{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:16px;
  border-radius:999px;
  color:#fff;
  font-size:10px;
  font-weight:800;
  line-height:1;
  box-shadow:0 0 0 2px #fff inset;
}

.legend-trade-buy{
  background:#16a34a;
}

.legend-trade-sell{
  background:#dc2626;
}
