/* Financial Benchmarks Phase 4: consumer spending analysis */

.bm4s-analysis {
  display: grid;
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 0 20px;
  gap: 18px;
}

.bm4s-view-stack {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.bm4s-view-stack[hidden] {
  display: none !important;
}

.bm4s-cohort-status {
  padding: 12px 14px;
  border: 1px solid rgba(119, 215, 204, 0.28);
  border-left: 4px solid #2a9d8f;
  border-radius: 9px;
  background: rgba(42, 157, 143, 0.09);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.84rem;
  line-height: 1.55;
}

.bm4s-cohort-status[data-state="unavailable"],
.bm4s-cohort-status[data-state="rejected"] {
  border-color: rgba(230, 149, 58, 0.4);
  border-left-color: #e6953a;
  background: rgba(230, 149, 58, 0.09);
}

.bm4s-view {
  min-width: 0;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 16px 38px rgba(7, 14, 30, 0.14);
}

.bm4s-view[data-bm4s-view="national-peers"] {
  border-color: rgba(119, 215, 204, 0.24);
  background:
    radial-gradient(
      circle at 8% 4%,
      rgba(42, 157, 143, 0.18),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.055),
      rgba(13, 24, 47, 0.7)
    );
}

.bm4s-view-header {
  max-width: 820px;
  margin-bottom: 20px;
}

.bm4s-view-header > p:first-child {
  margin: 0 0 8px;
  color: #8ce8dd;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bm4s-view-header h2,
.bm4s-view > h2 {
  margin: 0;
  color: #f3f7fb;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.2;
}

.bm4s-view-header > p:last-child,
.bm4s-view > p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.88rem;
  line-height: 1.62;
}

.bm4s-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.bm4s-module {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(7, 15, 31, 0.48);
}

.bm4s-module[data-state="not_conditioned"] {
  border-color: rgba(119, 215, 204, 0.34);
}

.bm4s-module-header {
  padding: 20px 20px 0;
}

.bm4s-module-header > p:first-child {
  margin: 0 0 9px;
  color: #8ce8dd;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bm4s-module h3 {
  margin: 0;
  color: #f3f7fb;
  font-family: var(--font-display);
  font-size: 1.16rem;
  line-height: 1.3;
}

.bm4s-module-header > p:last-child {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.79rem;
  line-height: 1.55;
}

.bm4s-key-result {
  margin: 17px 20px 0;
  padding: 16px;
  border: 1px solid rgba(42, 157, 143, 0.28);
  border-radius: 13px;
  background: linear-gradient(
    135deg,
    rgba(42, 157, 143, 0.15),
    rgba(42, 157, 143, 0.04)
  );
}

.bm4s-key-result > span {
  display: block;
  color: rgba(255, 255, 255, 0.73);
  font-size: 0.73rem;
  line-height: 1.52;
}

.bm4s-key-result > span:first-child {
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

.bm4s-key-result > strong {
  display: block;
  margin: 5px 0 4px;
  color: #f4fbfa;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.1rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bm4s-scope {
  margin: 12px 20px 0;
  padding-left: 11px;
  border-left: 3px solid rgba(140, 232, 221, 0.55);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.74rem;
  line-height: 1.55;
}

.bm4s-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 20px 0;
}

.bm4s-meta div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.bm4s-meta dt {
  margin-bottom: 3px;
  color: #8ce8dd;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bm4s-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.7rem;
  line-height: 1.42;
}

.bm4s-table-region {
  max-width: 100%;
  overflow-x: auto;
  margin-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-color: rgba(119, 215, 204, 0.55) rgba(255, 255, 255, 0.05);
}

.bm4s-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.bm4s-table caption {
  padding: 14px 20px 10px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
  text-align: left;
}

.bm4s-table th,
.bm4s-table td {
  padding: 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: right;
}

.bm4s-table th:first-child,
.bm4s-table td:first-child {
  text-align: left;
}

.bm4s-table thead th {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.bm4s-method {
  margin: 16px 20px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.bm4s-method summary {
  color: #baf3ec;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.bm4s-method p {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  line-height: 1.55;
}

.bm4s-module-footer {
  padding: 16px 20px 20px;
}

.bm4s-module-footer p {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.71rem;
  line-height: 1.5;
}

.bm4s-module-footer a,
.bm4s-view li a {
  color: #8ce8dd;
}

.bm4s-view > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.bm4s-table-region:focus-visible,
.bm4s-method summary:focus-visible,
.bm4s-view a:focus-visible {
  outline: 3px solid #8ce8dd;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .bm4s-module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .bm4s-analysis {
    padding: 0 14px;
  }

  .bm4s-view {
    padding: 18px 14px;
  }

  .bm4s-meta {
    grid-template-columns: 1fr;
  }

  .bm4s-module-header,
  .bm4s-module-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .bm4s-key-result,
  .bm4s-scope,
  .bm4s-meta,
  .bm4s-method {
    margin-left: 16px;
    margin-right: 16px;
  }
}

@media (forced-colors: active) {
  .bm4s-view,
  .bm4s-module,
  .bm4s-key-result,
  .bm4s-cohort-status {
    border: 1px solid CanvasText;
  }
}

@media print {
  .bm4s-analysis {
    display: block;
    max-width: none;
    margin: 20px 0;
    padding: 0;
  }

  .bm4s-view-stack,
  .bm4s-module-grid {
    display: block !important;
  }

  .bm4s-view,
  .bm4s-module {
    break-inside: avoid;
    margin-bottom: 16px;
    box-shadow: none;
  }

  .bm4s-table {
    min-width: 0;
  }

  .bm4s-table-region {
    overflow: visible;
  }

  .bm4s-method > * {
    display: block !important;
  }
}


