/* Intel Hub · COT Heatboard Reuters — full market cards (Spec+Hedgers + meta)
 * Escopo: #ih-panel-cot
 */

#ih-panel-cot,
#ih-cot-dashboard {
  --cot-steel: #4A8FA0;
  --cot-mint: #67E6C9;
  --cot-loss: #E77A7A;
  --cot-cream: #ebe5d8;
  --cot-dim: #8a96a3;
  --cot-mute: #5c6773;
  --cot-line: #1a2430;
  --cot-bg: #05070a;
  --cot-panel: #0a0e12;
  --cot-amber: #c8923a;
}

#ih-panel-cot {
  background: var(--cot-bg) !important;
}

#ih-panel-cot .ih-dash,
#ih-panel-cot .ih-dash-body,
#ih-cot-dashboard {
  background: var(--cot-bg) !important;
  min-height: 0;
}

#ih-panel-cot .ih-module-bar {
  background: var(--cot-panel) !important;
  border-bottom: 1px solid var(--cot-line) !important;
  box-shadow: none !important;
  min-height: 40px;
}

#ih-panel-cot .ih-module-title {
  color: var(--cot-steel) !important;
  font-family: var(--font-bloomberg, monospace) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase;
}

#ih-panel-cot .ih-dash-refresh {
  background: transparent !important;
  border: 1px solid var(--cot-line) !important;
  border-radius: 0 !important;
  color: var(--cot-dim) !important;
  box-shadow: none !important;
}

#ih-panel-cot .ih-dash-refresh:hover {
  border-color: rgba(74, 143, 160, 0.55) !important;
  color: var(--cot-steel) !important;
}

#ih-cot-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 !important;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

#ih-panel-cot.active,
#ih-panel-cot.active .ih-dash {
  min-height: 0;
  overflow: hidden;
}

.ih-cot-banner-note {
  background: transparent !important;
  border: 1px solid rgba(200, 146, 58, 0.4) !important;
  border-radius: 0 !important;
  color: var(--cot-amber) !important;
  font-family: var(--font-bloomberg, monospace);
  font-size: 13px;
  letter-spacing: 0.1em;
  margin: 8px 10px 0 !important;
  padding: 8px 12px !important;
  text-transform: uppercase;
}

/* Smart Money bias banner */
.ih-cot-smart {
  border: 1px solid var(--cot-line);
  margin: 10px 10px 0;
  padding: 14px 16px;
}

.ih-cot-smart--long { border-color: rgba(116, 222, 198, 0.45); }
.ih-cot-smart--short { border-color: rgba(224, 134, 134, 0.45); }
.ih-cot-smart--neutral { border-color: rgba(74, 143, 160, 0.4); }

.ih-cot-smart__top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ih-cot-smart__lbl,
.ih-cot-smart__score {
  color: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ih-cot-smart__val {
  font-family: var(--font-bloomberg, monospace);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ih-cot-smart--long .ih-cot-smart__val { color: var(--cot-mint); }
.ih-cot-smart--short .ih-cot-smart__val { color: var(--cot-loss); }
.ih-cot-smart--neutral .ih-cot-smart__val { color: var(--cot-steel); }

.ih-cot-smart__sum {
  color: var(--cot-cream);
  font-family: var(--font-bloomberg, monospace);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 8px;
  opacity: 0.85;
}

.ih-cot-smart__meta {
  color: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-top: 8px;
  text-transform: uppercase;
}

/* 1 card per market — Spec + Hedgers · ~2× altura (1 card ≈ viewport) + scroll */
.ih-cot-heatboard--cards {
  background: transparent;
  border: none;
  display: grid;
  flex: 0 0 auto;
  align-content: start;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  grid-auto-rows: auto;
  margin: 10px;
  min-height: 0;
  padding-bottom: 12px;
}

.ih-cot-card {
  background: var(--cot-bg);
  border: 1px solid var(--cot-line);
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* um pouco mais altos — mais ar entre Spec / Hedgers */
  min-height: max(780px, calc(100vh - 160px));
  padding: 20px 18px 18px;
  position: relative;
}

.ih-cot-card--extreme {
  box-shadow: inset 0 0 0 1px var(--cot-amber);
}

.ih-cot-cell__hdr {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.ih-cot-cell__title {
  font-family: var(--font-bloomberg, monospace);
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.ih-cot-cell__asset {
  color: var(--cot-cream);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.ih-cot-cell__ex {
  color: var(--cot-mute);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-left: 4px;
}

.ih-cot-cell__asof {
  color: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.ih-cot-card__bias {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 6px 0 4px;
}

.ih-cot-card__bias-lbl {
  color: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.ih-cot-card__bias-val {
  color: var(--cot-dim);
  flex: 1 1 auto;
  font-family: var(--font-bloomberg, monospace);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.ih-cot-card__bias--long .ih-cot-card__bias-val { color: var(--cot-mint); }
.ih-cot-card__bias--short .ih-cot-card__bias-val { color: var(--cot-loss); }

.ih-cot-card__badge {
  border: 1px solid rgba(200, 146, 58, 0.55);
  color: var(--cot-amber);
  font-family: var(--font-bloomberg, monospace);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  text-transform: uppercase;
}

.ih-cot-card__div {
  background: var(--cot-line);
  height: 1px;
  margin: 8px 0 6px;
}

.ih-cot-role {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  justify-content: space-between;
}

.ih-cot-role__top {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.ih-cot-role__lbl {
  color: var(--cot-dim);
  font-family: var(--font-bloomberg, monospace);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ih-cot-cell__net {
  font-family: var(--font-bloomberg, monospace);
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin-top: 2px;
}

.ih-cot-cell__net.spec-long,
.ih-cot-cell__net.comm-long { color: var(--cot-mint); }

.ih-cot-cell__net.spec-short,
.ih-cot-cell__net.comm-short { color: var(--cot-loss); }

.ih-cot-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 2px 0 6px;
}

.ih-cot-meta__delta,
.ih-cot-meta__pctl,
.ih-cot-meta__side {
  font-family: var(--font-bloomberg, monospace);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.ih-cot-meta__delta--up { color: var(--cot-mint); }
.ih-cot-meta__delta--down { color: var(--cot-loss); }
.ih-cot-meta__pctl { color: var(--cot-amber); }
.ih-cot-meta__side { color: var(--cot-dim); }

.ih-cot-cell__warn {
  color: var(--cot-amber);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ih-cot-cell__warn-icon {
  color: var(--cot-amber);
  display: inline-block;
  font-size: 11px;
  margin-right: 3px;
  transform: translateY(-1px);
}

/* Bidirectional net strip */
.ih-cot-strip {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 2px 0 6px;
}

.ih-cot-strip__axis {
  color: var(--cot-mute);
  flex: 0 0 auto;
  font-family: var(--font-bloomberg, monospace);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.ih-cot-strip__track {
  background: rgba(26, 36, 48, 0.9);
  flex: 1 1 auto;
  height: 12px;
  position: relative;
}

.ih-cot-strip__zero {
  background: rgba(235, 229, 216, 0.35);
  bottom: 0;
  left: 50%;
  position: absolute;
  top: 0;
  width: 1px;
  z-index: 1;
}

.ih-cot-strip__fill {
  bottom: 0;
  height: 100%;
  position: absolute;
  top: 0;
}

.ih-cot-strip__fill.spec-long,
.ih-cot-strip__fill.comm-long { background: var(--cot-mint); }

.ih-cot-strip__fill.spec-short,
.ih-cot-strip__fill.comm-short { background: var(--cot-loss); }

.ih-cot-hist-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  margin-top: 10px;
  min-height: 230px;
  width: 100%;
}

.ih-cot-hist {
  display: block;
  flex: 1 1 auto;
  height: 250px;
  max-height: 300px;
  min-height: 230px;
  width: 100%;
}

.ih-cot-hist__zero {
  stroke: rgba(235, 229, 216, 0.35);
  stroke-width: 1;
}

.ih-cot-hist__bar--pos { fill: var(--cot-mint); }
.ih-cot-hist__bar--neg { fill: var(--cot-loss); }

.ih-cot-hist__ytick,
.ih-cot-hist__xtick {
  fill: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.ih-cot-heatboard__foot {
  border-top: 1px solid var(--cot-line);
  color: var(--cot-mute);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  letter-spacing: 0.12em;
  margin: 0 10px 10px;
  padding: 10px 2px 0;
  text-transform: uppercase;
}

@media (max-width: 1100px) {
  .ih-cot-heatboard--cards {
    grid-template-columns: 1fr;
  }

  .ih-cot-card {
    min-height: max(700px, calc(100vh - 150px));
  }
}

body.ih-hub-full .ih-cot-card {
  min-height: max(820px, calc(100vh - 130px));
}

#ih-cot-dashboard .ih-cot-stack {
  display: none !important;
}

/* Clickable / expand */
.ih-cot-card--clickable {
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.ih-cot-card--clickable:hover,
.ih-cot-card--clickable:focus-visible {
  border-color: rgba(74, 143, 160, 0.7);
  outline: none;
}

.ih-cot-card__expand-hint {
  color: var(--cot-steel);
  font-family: var(--font-bloomberg, monospace);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-left: auto;
  text-transform: uppercase;
  white-space: nowrap;
}

.ih-cot-card__roles {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
  min-height: 0;
}

.ih-cot-expand.ih-fred-modal:not(.ih-hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
}

.ih-cot-expand__panel {
  background: #05070a !important;
  border: 1px solid #1a2430 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  height: min(92vh, 920px);
  max-height: 92vh;
  max-width: min(1180px, 96vw);
  width: min(1180px, 96vw);
}

.ih-cot-expand__panel .ih-fred-modal-hdr {
  border-bottom: 1px solid #1a2430;
  flex-shrink: 0;
}

.ih-cot-expand__panel .ih-macro-card-title {
  color: #4A8FA0 !important;
  font-size: 18px !important;
  letter-spacing: 0.12em !important;
}

.ih-cot-expand__panel .ih-macro-card-sub {
  color: #8a96a3 !important;
  font-size: 13px !important;
}

.ih-cot-expand__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 10px;
}

.ih-cot-expand__foot {
  border-top: 1px solid #1a2430;
  color: #5c6773 !important;
  flex-shrink: 0;
  font-size: 11px !important;
  letter-spacing: 0.1em;
  padding: 10px 16px !important;
  text-transform: uppercase;
}

.ih-cot-card--expanded {
  background: var(--cot-bg);
  border: 1px solid var(--cot-line);
  cursor: default;
  padding: 18px 18px 16px;
}

/* Expand in-place — same card, full board */
#ih-cot-dashboard.ih-cot-dashboard--zoomed {
  overflow: hidden;
}

#ih-cot-dashboard.ih-cot-dashboard--zoomed .ih-cot-smart,
#ih-cot-dashboard.ih-cot-dashboard--zoomed .ih-cot-banner-note,
#ih-cot-dashboard.ih-cot-dashboard--zoomed .ih-cot-heatboard__foot {
  display: none;
}

.ih-cot-heatboard--zoomed {
  display: grid !important;
  flex: 1 1 auto !important;
  grid-template-columns: minmax(0, 1fr) !important;
  height: auto;
  margin: 10px !important;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

.ih-cot-heatboard--zoomed > .ih-cot-card:not(.ih-cot-card--zoomed) {
  display: none !important;
}

.ih-cot-card--zoomed {
  background: var(--cot-bg) !important;
  border: 1px solid var(--cot-line) !important;
  height: 100%;
  max-height: calc(100vh - 120px);
  min-height: min(860px, calc(100vh - 140px)) !important;
  overflow: auto;
  padding: 20px 22px 18px !important;
}

.ih-cot-card__expand-hint--collapse {
  border-color: rgba(74, 143, 160, 0.55);
  color: var(--cot-steel);
  cursor: pointer;
}

.ih-cot-card--expanded .ih-cot-cell__asset {
  font-size: 22px;
}

.ih-cot-card--expanded .ih-cot-cell__asof {
  font-size: 14px;
}

.ih-cot-card--expanded .ih-cot-card__bias-val {
  font-size: 15px;
}

.ih-cot-card--expanded .ih-cot-card__badge {
  font-size: 13px;
  padding: 4px 10px;
}

.ih-cot-card--expanded .ih-cot-card__roles--split {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
}

.ih-cot-card--expanded .ih-cot-card__div {
  display: none;
}

.ih-cot-card--expanded .ih-cot-role {
  background: #0a0e12;
  border: 1px solid #1a2430;
  padding: 14px 16px 12px;
}

.ih-cot-card--expanded .ih-cot-role__lbl {
  font-size: 13px;
}

.ih-cot-card--expanded .ih-cot-cell__net {
  font-size: clamp(36px, 4vw, 48px);
  margin-top: 6px;
}

.ih-cot-card--expanded .ih-cot-meta {
  gap: 10px 18px;
  margin: 6px 0 10px;
}

.ih-cot-card--expanded .ih-cot-meta__delta,
.ih-cot-card--expanded .ih-cot-meta__pctl,
.ih-cot-card--expanded .ih-cot-meta__side {
  font-size: 15px;
}

.ih-cot-card--expanded .ih-cot-strip {
  margin: 4px 0 12px;
}

.ih-cot-card--expanded .ih-cot-strip__track {
  height: 12px;
}

.ih-cot-card--expanded .ih-cot-hist {
  height: 260px;
  max-height: 300px;
  min-height: 240px;
}

.ih-cot-card--expanded .ih-cot-hist-wrap {
  min-height: 240px;
}

.ih-cot-card--expanded .ih-cot-hist__ytick,
.ih-cot-card--expanded .ih-cot-hist__xtick {
  font-size: 13px;
}

@media (max-width: 900px) {
  .ih-cot-card--expanded .ih-cot-card__roles--split {
    grid-template-columns: 1fr;
  }
  .ih-cot-card--expanded .ih-cot-card__div {
    display: block;
  }
}
