/* Foreign Flow Intelligence (#foreign) */
#foreign-pro-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

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

.fg-kpi-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.24));
  background: rgba(148, 163, 184, 0.05);
  min-width: 0;
}

.fg-kpi-card span {
  display: block;
  font-size: 11.5px;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}

.fg-kpi-card strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fg-kpi-card small {
  display: block;
  font-size: 11.5px;
  color: var(--muted, #64748b);
  margin-top: 3px;
}

.fg-exchange-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.fg-ex-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.22));
  background: rgba(148, 163, 184, 0.04);
  font-size: 12.5px;
}

.fg-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  min-width: 0;
}

.fg-sector-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.fg-sector-row {
  display: grid;
  grid-template-columns: minmax(0, 145px) minmax(0, 1fr) 86px;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.fg-sector-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.fg-div-track {
  position: relative;
  height: 14px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.fg-div-track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(100, 116, 139, 0.45);
}

.fg-div-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
}

.fg-div-bar.buy {
  left: 50%;
  background: #10b981;
}

.fg-div-bar.sell {
  right: 50%;
  background: #f43f5e;
}

.fg-preset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

#foreign-pro-root .fg-tab-btn {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.3));
  background: transparent;
  color: inherit;
  cursor: pointer;
}

#foreign-pro-root .fg-tab-btn.active,
#foreign-pro-root .fg-tab-btn.active:hover,
#foreign-pro-root .fg-tab-btn.active:focus {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.fg-click-row {
  cursor: pointer;
}

.fg-click-row:hover {
  background: rgba(13, 148, 136, 0.08);
}

.fg-stock-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.fg-stock-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fg-regime-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(13, 148, 136, 0.35);
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
}

.fg-regime-pill.absorb {
  border-color: rgba(2, 132, 199, 0.4);
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
}

.fg-regime-pill.accum {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.fg-regime-pill.down {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.12);
  color: #be123c;
}

.fg-callout {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  background: rgba(148, 163, 184, 0.08);
  border-left: 3px solid #0284c7;
}

.fg-svg-wrap {
  width: 100%;
  min-width: 0;
}

.fg-svg-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.fg-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 6px;
}

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

.fg-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.fg-chart-tip {
  min-height: 22px;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-top: 6px;
}

.fg-own-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
  margin: 8px 0;
}

.fg-own-seg-fg { background: #0284c7; height: 100%; }
.fg-own-seg-st { background: #f59e0b; height: 100%; }
.fg-own-seg-ot { background: #94a3b8; height: 100%; }

.fg-own-kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.18);
}

@media (max-width: 1060px) {
  .fg-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .fg-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .fg-exchange-strip {
    grid-template-columns: minmax(0, 1fr);
  }
  .fg-sector-row {
    grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 74px;
  }
}
