/* Capital flows map — D-CORE-style layout on Ultra Index shell */

.flows-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.flows-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.flows-toolbar {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--landing-border);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.flows-toolbar-title {
  margin-bottom: 0.65rem;
}

.flows-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--landing-muted);
}

.flows-title {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--landing-text);
}

.flows-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  margin: 0;
  border: 1px solid var(--landing-border, #e2e8f0);
  border-radius: 10px;
  background: #f8fafc;
}

.flows-filter {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--landing-muted, #64748b);
}

.flows-filter-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--landing-muted, #64748b);
  white-space: nowrap;
}

.flows-filter select {
  min-width: 5.75rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--landing-border, #e2e8f0);
  border-radius: 6px;
  background: #fff;
  color: var(--landing-text, #0f172a);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
}

.flows-filter select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}

.flows-filter--toggle {
  height: 2rem;
  padding: 0 0.65rem;
  border: 1px solid var(--landing-border, #e2e8f0);
  border-radius: 6px;
  background: #fff;
  color: var(--landing-text, #0f172a);
  cursor: pointer;
  user-select: none;
}

.flows-filter--toggle input {
  margin: 0;
  accent-color: #2563eb;
}

.flows-filter--toggle:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
  color: #1d4ed8;
}

.flows-reset {
  margin-left: 0.15rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--landing-muted, #64748b);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}

.flows-reset:hover {
  color: var(--landing-text, #0f172a);
  background: #fff;
  border-color: var(--landing-border, #e2e8f0);
}

.flows-meta {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--landing-muted);
}

.flows-meta a {
  color: var(--landing-accent);
  text-decoration: none;
}

.flows-meta a:hover {
  text-decoration: underline;
}

.flows-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.flows-map-panel {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #eef2f6;
  border-right: 1px solid var(--landing-border);
}

.flows-map-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.flows-map-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.flows-country {
  stroke: #fff;
  stroke-width: 0.4;
  cursor: pointer;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
}

.flows-country:hover,
.flows-country.is-hover {
  stroke: #0f172a;
  stroke-width: 1;
}

.flows-country.is-selected {
  stroke: #0f172a;
  stroke-width: 1.4;
  filter: brightness(0.92);
}

.flows-country.is-nodata {
  cursor: default;
}

.flows-legend {
  position: absolute;
  left: 1rem;
  bottom: 2.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--landing-border);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--landing-text);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  max-width: 14rem;
}

.flows-legend-title {
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.flows-legend-note {
  margin: 0.45rem 0 0;
  font-size: 0.68rem;
  color: var(--landing-muted);
  line-height: 1.35;
}

.flows-legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0;
}

.flows-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #dbe3ec;
}

.flows-swatch--in {
  background: #0d9488;
}

.flows-swatch--out {
  background: #c2410c;
}

.flows-swatch--flat {
  background: #94a3b8;
}

.flows-swatch--nodata {
  background: #dbe3ec;
}

.flows-swatch--delta-1 {
  background: #99f6e4;
}

.flows-swatch--delta-2 {
  background: #2dd4bf;
}

.flows-swatch--delta-3 {
  background: #0f766e;
}

.flows-hint {
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--landing-border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--landing-muted);
  pointer-events: none;
}

.flows-loading,
.flows-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: rgba(238, 242, 246, 0.85);
  color: var(--landing-muted);
  font-size: 0.95rem;
}

.flows-loading[hidden],
.flows-error[hidden] {
  display: none !important;
}

.flows-error {
  color: #b91c1c;
  padding: 2rem;
  text-align: center;
}

.flows-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 0.45rem 0.65rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.35;
  max-width: 16rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.flows-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--landing-surface);
}

.flows-side-hd {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--landing-border);
}

.flows-side-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.flows-side-count {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--landing-muted);
}

.flows-detail {
  flex-shrink: 0;
  margin: 0.75rem 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--landing-border);
  border-radius: 8px;
  background: #f8fafc;
}

.flows-detail-name {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 650;
}

.flows-detail-meta {
  margin: 0.2rem 0;
  font-size: 0.8rem;
  color: var(--landing-muted);
}

.flows-detail-meta strong {
  color: var(--landing-text);
  font-weight: 600;
}

.flows-detail a {
  color: var(--landing-accent);
  font-size: 0.8rem;
}

.flows-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.flows-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--landing-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.flows-card:hover {
  border-color: #94a3b8;
}

.flows-card.is-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.flows-card-name {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.flows-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.flows-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 550;
}

.flows-tag.is-in {
  background: #dcfce7;
  color: #166534;
}

.flows-tag.is-out {
  background: #fee2e2;
  color: #991b1b;
}

.flows-tag.is-flat {
  background: #e2e8f0;
  color: #475569;
}

.flows-tag.is-vel-in {
  background: #e0f2fe;
  color: #075985;
}

.flows-tag.is-vel-out {
  background: #ffedd5;
  color: #9a3412;
}

.flows-card-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--landing-muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.flows-card-row .is-pos {
  color: #15803d;
}

.flows-card-row .is-neg {
  color: #b91c1c;
}

.flows-list-empty {
  margin: 1rem;
  color: var(--landing-muted);
  font-size: 0.9rem;
}

/* Color tokens for choropleth */
:root {
  --flows-in: #0d9488;
  --flows-out: #c2410c;
  --flows-flat: #94a3b8;
  --flows-nodata: #dbe3ec;
  --flows-delta-1: #99f6e4;
  --flows-delta-2: #2dd4bf;
  --flows-delta-3: #0f766e;
}

@media (max-width: 900px) {
  .flows-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 42vh) minmax(0, 1fr);
  }

  .flows-map-panel {
    height: auto;
    min-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--landing-border);
  }

  .flows-side {
    max-height: none;
  }

  .flows-reset {
    margin-left: 0;
  }
}
