:root {
  --bg: #f3efe6;
  --bg-ink: #f8f5ee;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-strong: rgba(255, 253, 248, 0.98);
  --line: rgba(29, 42, 57, 0.12);
  --line-strong: rgba(29, 42, 57, 0.2);
  --text: #162231;
  --muted: #667687;
  --deep: #14273e;
  --accent: #c26c3a;
  --accent-soft: rgba(194, 108, 58, 0.12);
  --teal: #2f897d;
  --teal-soft: rgba(47, 137, 125, 0.12);
  --blue: #4c74c7;
  --blue-soft: rgba(76, 116, 199, 0.12);
  --gold: #b9912c;
  --gold-soft: rgba(185, 145, 44, 0.13);
  --shadow: 0 18px 50px rgba(24, 34, 49, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(194, 108, 58, 0.13), transparent 32%),
    radial-gradient(circle at top right, rgba(47, 137, 125, 0.13), transparent 28%),
    linear-gradient(180deg, #f9f6ef 0%, #f2ede2 100%);
  font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(20, 39, 62, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 39, 62, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 85%);
  pointer-events: none;
}

body,
button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
  min-width: 0;
}

.loading-panel,
.panel,
.hero-meta,
.hero-copy,
.summary-card,
.filter-card,
.info-card,
.insight-card,
.chip-card,
.table-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.loading-panel,
.panel,
.hero-meta,
.hero-copy {
  border-radius: var(--radius-xl);
  padding: 26px;
}

.summary-card,
.filter-card,
.info-card,
.insight-card,
.chip-card,
.table-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.loading-panel {
  margin-top: 80px;
  max-width: 740px;
}

.hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 18px;
  min-width: 0;
}

.hero > *,
.panel-grid > *,
.filter-grid > *,
.source-grid > *,
.insight-grid > *,
.company-grid > *,
.category-card-grid > * {
  min-width: 0;
  max-width: 100%;
}

.hero-copy {
  background:
    linear-gradient(140deg, rgba(255, 252, 248, 0.98), rgba(255, 247, 236, 0.95)),
    var(--panel);
}

.hero-meta {
  background:
    linear-gradient(160deg, rgba(20, 39, 62, 0.98), rgba(34, 55, 77, 0.94)),
    var(--deep);
  color: #f7f1e4;
  border-color: rgba(255, 255, 255, 0.08);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.hero-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hero-refresh {
  min-width: 160px;
}

.hero-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-status.positive {
  color: var(--teal);
}

.hero-status.negative {
  color: var(--accent);
}

.summary-card {
  min-height: 152px;
}

.summary-card.primary {
  background: linear-gradient(180deg, rgba(255, 245, 236, 0.98), rgba(255, 250, 243, 0.98));
}

.summary-card.good {
  background: linear-gradient(180deg, rgba(237, 251, 248, 0.98), rgba(248, 254, 252, 0.98));
}

.summary-card.warm {
  background: linear-gradient(180deg, rgba(253, 247, 233, 0.98), rgba(255, 251, 245, 0.98));
}

.summary-card .value,
.hero-meta-value {
  font-family: "Bahnschrift", "Aptos Display", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

.eyebrow,
.section-kicker,
.small-label,
.filter-label,
.source-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.hero-meta .eyebrow,
.hero-meta .small-label,
.hero-meta .source-label {
  color: rgba(247, 241, 228, 0.7);
}

h1,
h2,
h3,
h4,
th {
  margin: 0;
  font-family: "Bahnschrift", "Aptos Display", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.55rem;
  line-height: 1.15;
}

h3 {
  font-size: 1.08rem;
  line-height: 1.24;
}

p {
  line-height: 1.6;
}

.hero-lede,
.muted,
.section-subtitle,
.metric-detail,
.meta-note,
.insight-body,
.table-note,
.source-note,
.legend-note,
.filter-card p,
.panel-subtext {
  color: var(--muted);
}

.hero-meta-value {
  margin: 6px 0 0;
  font-size: 2rem;
}

.hero-meta .metric-detail,
.hero-meta .source-note,
.hero-meta .muted {
  color: rgba(247, 241, 228, 0.72);
}

.hero-meta-list {
  display: grid;
  gap: 18px;
  margin-top: 8px;
}

.hero-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(247, 241, 228, 0.82);
}

.hero-meta-row strong {
  text-transform: capitalize;
}

.hero-meta-row.compact {
  color: var(--text);
  border-top-color: var(--line);
  padding-top: 8px;
}

.summary-value {
  margin: 10px 0 8px;
  font-size: clamp(1.8rem, 2vw, 2.1rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.summary-change {
  margin: 0;
  font-weight: 700;
  color: var(--deep);
}

.summary-card.good .summary-change {
  color: var(--teal);
}

.summary-card.warm .summary-change {
  color: var(--gold);
}

.summary-meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.section {
  margin-top: 20px;
}

.section-anchor {
  scroll-margin-top: 118px;
}

.section-flash {
  animation: section-pulse 1.2s ease;
}

@keyframes section-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 137, 125, 0.26), var(--shadow);
    border-color: rgba(47, 137, 125, 0.42);
  }
  100% {
    box-shadow: var(--shadow);
    border-color: var(--line);
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 22px;
}

.filters {
  position: sticky;
  top: 14px;
  z-index: 10;
  margin-top: 18px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.filter-card {
  background: var(--panel-strong);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.filter-field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #fffdfa;
}

.filter-field.is-static select,
.filter-field select:disabled {
  background: rgba(20, 39, 62, 0.04);
  color: var(--muted);
  cursor: not-allowed;
}

.panel-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel-grid.two {
  grid-template-columns: 1.3fr 1fr;
}

.panel-grid.three {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.panel-grid.four {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.meta-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  background: rgba(20, 39, 62, 0.05);
  color: var(--text);
}

.pill.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.pill.hidden {
  background: var(--accent-soft);
  color: var(--accent);
}

.source-grid,
.insight-grid,
.company-grid,
.category-card-grid {
  display: grid;
  gap: 14px;
}

.source-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.category-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.insight-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.company-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.info-card-head,
.insight-head,
.chip-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.stat-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.stat-inline-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat-block {
  min-width: 108px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(20, 39, 62, 0.04);
}

.stat-block strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
}

.chart-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  padding: 18px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.chart-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.chart-frame {
  width: 100%;
  overflow: hidden;
}

.line-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.stack-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr auto;
  gap: 14px;
  align-items: center;
}

.stack-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(20, 39, 62, 0.06);
}

.stack-fill {
  height: 100%;
  border-radius: inherit;
}

.subsegment-list,
.fuel-list,
.tag-list,
.hidden-list {
  display: grid;
  gap: 12px;
}

.channel-grid {
  align-items: stretch;
}

.channel-card {
  height: 100%;
}

.channel-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.channel-note {
  height: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(20, 39, 62, 0.04), rgba(20, 39, 62, 0.06));
  color: var(--muted);
  line-height: 1.45;
}

.channel-trend-grid,
.mini-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-table-card,
.mini-insight {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(20, 39, 62, 0.04);
}

.mini-insight strong {
  display: block;
  margin-top: 8px;
  font-size: 1.02rem;
}

.mini-insight p {
  margin: 6px 0 0;
  color: var(--muted);
}

.subsegment-row,
.fuel-row,
.table-toolbar,
.source-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.subsegment-row,
.fuel-row,
.source-row,
.hidden-item {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.subsegment-row:first-child,
.fuel-row:first-child,
.source-row:first-child,
.hidden-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: middle;
  line-height: 1.42;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
}

td {
  font-size: 0.97rem;
}

th:first-child,
td:first-child {
  width: 34%;
}

th:not(:first-child),
td:not(:first-child) {
  width: auto;
}

tbody tr:hover {
  background: rgba(20, 39, 62, 0.03);
}

.positive {
  color: var(--teal);
}

.negative {
  color: var(--accent);
}

.neutral {
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fffdfa;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-primary {
  border-color: rgba(20, 39, 62, 0.18);
  background: linear-gradient(180deg, rgba(20, 39, 62, 0.98), rgba(34, 55, 77, 0.94));
  color: #f7f1e4;
}

.button-loader {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(247, 241, 228, 0.32);
  border-top-color: #f7f1e4;
  display: inline-block;
  margin-right: 8px;
  vertical-align: -2px;
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.button:hover,
th:hover {
  color: var(--deep);
}

.button-link {
  text-decoration: none;
}

.source-button {
  padding: 7px 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.tooltip-note {
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

.empty-note {
  padding: 15px 17px;
  border-radius: var(--radius-md);
  background: rgba(20, 39, 62, 0.05);
  color: var(--muted);
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20, 39, 62, 0.16), transparent);
  margin: 24px 0;
}

@media (max-width: 1180px) {
  .hero,
  .panel-grid.two,
  .panel-grid.three,
  .panel-grid.four,
  .source-grid,
  .insight-grid,
  .company-grid,
  .category-card-grid,
  .hero-grid,
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-inline-compact,
  .channel-note-grid,
  .channel-trend-grid,
  .mini-insight-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 18px, 1380px);
    padding-top: 18px;
  }

  .table-card,
  .chart-card,
  .filter-card,
  .info-card,
  .insight-card,
  .chip-card,
  .summary-card {
    padding: 16px;
  }

  .hero,
  .panel-grid.two,
  .panel-grid.three,
  .panel-grid.four,
  .source-grid,
  .insight-grid,
  .company-grid,
  .category-card-grid,
  .hero-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .stat-inline-compact,
  .channel-note-grid,
  .channel-trend-grid,
  .mini-insight-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .chart-title-row,
  .subsegment-row,
  .fuel-row,
  .table-toolbar,
  .source-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-toolbar {
    align-items: flex-start;
  }

  .stack-row {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 11px 8px;
    font-size: 0.9rem;
  }

  th {
    font-size: 0.74rem;
  }
}

.news-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 18px;
}

.article-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.news-meta,
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.news-card h3 {
  margin: 12px 0 8px;
}

.news-card a {
  color: inherit;
}

.score-chip {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.button-link {
  text-decoration: none;
}

.matrix-table th,
.matrix-table td {
  white-space: normal;
}

.matrix-count {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  border-radius: 10px;
  padding: 6px 8px;
  background: rgba(194, 108, 58, 0.12);
}
