:root {
  --bg: #0d1117;
  --bg-soft: #111927;
  --surface: rgba(15, 23, 36, 0.8);
  --surface-strong: rgba(20, 31, 47, 0.92);
  --surface-glass: rgba(255, 255, 255, 0.05);
  --ink: #edf3ff;
  --muted: #98a8be;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #f45d48;
  --accent-2: #d8a84e;
  --cyan: #66e0d2;
  --blue: #7ca9ff;
  --export: #3fe0a1;
  --export-soft: rgba(63, 224, 161, 0.16);
  --import: #ff6f61;
  --import-soft: rgba(255, 111, 97, 0.16);
  --positive: #57e389;
  --negative: #ff6b6b;
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.32);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(124, 169, 255, 0.13), transparent 26%),
    radial-gradient(circle at top right, rgba(102, 224, 210, 0.11), transparent 20%),
    linear-gradient(180deg, #091018 0%, #101827 52%, #0d1117 100%);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

.page-glow {
  position: fixed;
  inset: auto;
  width: 42vw;
  height: 42vw;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}

.page-glow-a {
  top: -12vw;
  right: -8vw;
  background: rgba(124, 169, 255, 0.5);
}

.page-glow-b {
  bottom: -14vw;
  left: -8vw;
  background: rgba(244, 93, 72, 0.4);
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
}

.sidebar {
  min-width: 0;
  padding: 28px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(9, 15, 24, 0.84);
  backdrop-filter: blur(18px);
}

.content {
  min-width: 0;
  padding: 30px;
}

.brand {
  margin-bottom: 22px;
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 10px);
  gap: 7px;
  margin-bottom: 18px;
}

.brand-mark span {
  display: block;
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
}

.brand-mark span:nth-child(2) {
  height: 30px;
}

.brand-mark span:nth-child(1),
.brand-mark span:nth-child(3) {
  height: 20px;
  margin-top: 5px;
}

.brand h1,
.hero h2,
.panel h2,
.highlight-panel h2 {
  margin: 0;
  font-family: "Baskerville", "Times New Roman", serif;
  letter-spacing: -0.03em;
}

.brand h1 {
  font-size: 2.65rem;
  line-height: 0.95;
  max-width: 8ch;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
  margin: 14px 0 0;
}

.eyebrow,
.micro-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--cyan);
}

.micro-label {
  display: inline-block;
  margin-bottom: 8px;
}

.panel,
.stat,
.signal-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.panel {
  width: 100%;
  min-width: 0;
  padding: 22px;
}

.panel-soft {
  background:
    linear-gradient(180deg, rgba(102, 224, 210, 0.08), rgba(255, 255, 255, 0.03)),
    var(--surface-strong);
}

.panel-topline,
.panel-head,
.bar-label,
.timeline-row,
.source-card strong,
.filter-actions {
  display: flex;
  align-items: center;
}

.panel-topline,
.panel-head,
.bar-label {
  justify-content: space-between;
}

.micro-value,
.panel-head span,
.source-card p,
.meta-list,
label,
small {
  color: var(--muted);
}

.filters {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  width: 100%;
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  width: 100%;
  min-width: 0;
}

input,
select,
button {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-size: 0.96rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

input,
select {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

button {
  cursor: pointer;
  border: 0;
  font-weight: 700;
  color: #0a1018;
  background: linear-gradient(135deg, var(--cyan), var(--accent-2));
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.filter-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.filter-actions button {
  min-width: 0;
}

.sidebar-stack {
  display: grid;
  gap: 12px;
}

.sidebar-card {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.sidebar-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.sidebar-card strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  font-size: 1.15rem;
}

.sidebar-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  margin-bottom: 18px;
}

.hero-copy,
.hero-visual {
  border-radius: 34px;
  min-height: 320px;
  overflow: hidden;
}

.hero-copy {
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(13, 20, 31, 0.8);
  border: 1px solid var(--line);
}

.hero h2 {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.9;
  max-width: 10ch;
  margin-top: 10px;
}

.hero-text {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.6;
  margin: 18px 0 0;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.tag,
.code-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.code-pill-button {
  cursor: pointer;
  color: #c9d9ff;
  background: rgba(124, 169, 255, 0.14);
  border: 1px solid rgba(124, 169, 255, 0.2);
}

.code-pill-button:hover {
  background: rgba(124, 169, 255, 0.22);
}

.tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.hero-visual {
  position: relative;
  background:
    linear-gradient(180deg, rgba(124, 169, 255, 0.12), rgba(244, 93, 72, 0.06)),
    rgba(13, 20, 31, 0.9);
  border: 1px solid var(--line);
}

.radar-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 92%);
}

.radar-ring {
  position: absolute;
  border: 1px solid rgba(102, 224, 210, 0.28);
  border-radius: 999px;
}

.ring-1 {
  inset: 18% 16%;
}

.ring-2 {
  inset: 28% 26%;
}

.ring-3 {
  inset: 38% 36%;
}

.radar-card {
  position: absolute;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(9, 15, 24, 0.82);
  border: 1px solid var(--line);
  min-width: 144px;
}

.radar-card strong {
  display: block;
  font-size: 1.6rem;
  margin-top: 6px;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
}

.radar-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.radar-card-a {
  top: 24px;
  left: 24px;
}

.radar-card-b {
  right: 24px;
  bottom: 24px;
}

.signal-strip,
.stats,
.narrative-grid,
.grid-three {
  display: grid;
  gap: 16px;
}

.signal-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.signal-card {
  padding: 18px 20px;
}

.signal-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat {
  padding: 20px;
}

.stat strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 2.2rem;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
}

.stat-neutral .stat-value {
  color: var(--ink);
}

.stat-export .stat-value {
  color: var(--export);
}

.stat-import .stat-value {
  color: var(--import);
}

.stat-positive .stat-value {
  color: var(--positive);
}

.stat-negative .stat-value {
  color: var(--negative);
}

.stat-export {
  box-shadow: inset 0 0 0 1px rgba(63, 224, 161, 0.14), var(--shadow);
}

.stat-import {
  box-shadow: inset 0 0 0 1px rgba(255, 111, 97, 0.14), var(--shadow);
}

.stat-positive {
  box-shadow: inset 0 0 0 1px rgba(87, 227, 137, 0.18), var(--shadow);
}

.stat-negative {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.18), var(--shadow);
}

.narrative-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.chart-panel-accent {
  background:
    linear-gradient(180deg, rgba(102, 224, 210, 0.07), rgba(124, 169, 255, 0.03)),
    var(--surface);
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.bar-fill-1 {
  background: linear-gradient(90deg, var(--export), var(--cyan));
}

.bar-fill-2 {
  background: linear-gradient(90deg, var(--import), var(--accent));
}

.bar-fill-3 {
  background: linear-gradient(90deg, var(--blue), var(--accent-2));
}

.grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.risk-panel {
  margin-bottom: 16px;
}

.risk-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.risk-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.risk-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.risk-card p,
.risk-card small {
  display: block;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.highlight-panel h2 {
  margin-top: 4px;
  font-size: 2rem;
}

.highlight-panel p {
  margin: 10px 0 0;
  color: var(--muted);
}

.timeline-panel,
.table-panel {
  margin-bottom: 16px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-row {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.badge-export {
  background: var(--export-soft);
  color: var(--export);
}

.badge-import {
  background: var(--import-soft);
  color: var(--import);
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.risk-chip-basso {
  background: rgba(124, 169, 255, 0.14);
  color: #b7ccff;
}

.risk-chip-medio {
  background: rgba(216, 168, 78, 0.18);
  color: #f3c86c;
}

.risk-chip-alto {
  background: rgba(255, 107, 107, 0.18);
  color: #ff8f8f;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
}

thead th {
  color: var(--muted);
  font-weight: 600;
}

.code-pill {
  background: rgba(124, 169, 255, 0.14);
  border: 1px solid rgba(124, 169, 255, 0.2);
  color: #c9d9ff;
  font-family: ui-monospace, "SFMono-Regular", monospace;
}

.code-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.code-pill-inline {
  cursor: default;
}

.code-pill-current {
  background: rgba(102, 224, 210, 0.18);
  border-color: rgba(102, 224, 210, 0.3);
  color: var(--cyan);
}

.code-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 14, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 3;
}

.code-tooltip strong,
.code-tooltip span {
  display: block;
}

.code-tooltip strong {
  margin-bottom: 5px;
  color: #d7e5ff;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.84rem;
}

.code-tooltip span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.84rem;
}

.tooltip-wrap:hover .code-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.source-card {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.source-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.source-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.source-card p,
.meta-list {
  line-height: 1.6;
}

.meta-list {
  margin: 0;
  padding-left: 18px;
}

.empty-state {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 14, 0.72);
  backdrop-filter: blur(10px);
}

.modal-dialog {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 16px auto;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(124, 169, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(11, 18, 28, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  z-index: 1;
}

.modal-header {
  margin-top: -26px;
  margin-bottom: 18px;
}

.modal-header h2 {
  font-size: clamp(1.9rem, 3vw, 3rem);
  margin: 8px 0 10px;
}

.modal-header p,
.modal-summary {
  color: var(--muted);
  line-height: 1.65;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.modal-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.detail-value {
  display: block;
  font-size: 1rem;
  line-height: 1.45;
}

.narrative-grid-bottom {
  margin-bottom: 10px;
}

@media (max-width: 1240px) {
  .shell,
  .hero,
  .stats,
  .signal-strip,
  .grid-three,
  .narrative-grid,
  .risk-overview {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .sidebar,
  .content {
    padding: 18px;
  }

  .hero-copy,
  .hero-visual {
    min-height: auto;
  }

  .hero h2 {
    font-size: 2.6rem;
  }

  .timeline-row {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: start;
  }

  .filter-actions {
    grid-template-columns: 1fr;
  }

  .modal-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
