/* CEX → CSAM public scoreboard (parity with Surikata-X weekly_flagged embed) */
.cex-public-page {
  background-color: #0a0e17;
}

.cex-public-page main {
  padding-bottom: 48px;
}

/* Full-width layout (replaces narrow .container for these pages) */
.ds-page-main {
  width: 100%;
  box-sizing: border-box;
  padding: 0 clamp(12px, 2.5vw, 40px);
}

.ds-page-shell {
  width: 100%;
  max-width: min(100%, 1920px);
  margin: 0 auto;
  padding-top: 24px;
}

/* Initial / fetch loading */
.cex-loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: min(50vh, 420px);
  padding: 40px 24px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: 14px;
  background: rgba(10, 14, 22, 0.75);
  color: var(--color-text-secondary);
  text-align: center;
}

.cex-loading-copy strong {
  color: #e8f4f8;
  font-size: 1.05rem;
}

.cex-loading-sub {
  margin: 8px 0 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 28rem;
}

.cex-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(0, 212, 255, 0.2);
  border-top-color: var(--color-electric-blue);
  border-radius: 50%;
  animation: cex-spin 0.7s linear infinite;
}

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

.bq-banner {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
}

.bq-banner.error {
  background: rgba(255, 82, 82, 0.08);
  border-color: rgba(255, 82, 82, 0.35);
  color: #ffb4b4;
}

.bq-banner code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #00d4ff;
}

.cex-scoreboard-section {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
}

.cex-scoreboard-title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  margin: 8px 0 0 0;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cex-scoreboard-lede {
  color: #8a9faa;
  max-width: min(100%, 56rem);
  line-height: 1.55;
  font-size: 14px;
  margin-top: 12px;
}

.score-kicker {
  color: #00d4ff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.score-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  align-items: flex-end;
}

.score-hero--simple {
  justify-content: flex-start;
  align-items: flex-start;
  margin-bottom: 22px;
}

.cex-range-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-top: 6px;
}

.cex-insights-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.cex-range-switch--graph {
  margin-left: 0;
  padding-top: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cex-range-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  color: #8eb6c6;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 212, 255, 0.06);
  transition: all 0.16s ease;
  cursor: pointer;
  font-family: inherit;
}

.cex-range-chip:hover {
  color: #c9f2ff;
  border-color: rgba(0, 212, 255, 0.45);
  background: rgba(0, 212, 255, 0.13);
}

.cex-range-chip.active {
  color: #0a1218;
  border-color: rgba(102, 231, 255, 0.72);
  background: linear-gradient(180deg, #66e7ff, #24c6e8);
  box-shadow: 0 10px 22px rgba(0, 212, 255, 0.24);
}

.cex-range-chip.is-loading {
  opacity: 0.66;
  pointer-events: none;
  filter: saturate(0.8);
}

@media (max-width: 760px) {
  .cex-range-switch {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .cex-insights-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cex-range-switch--graph {
    width: 100%;
    justify-content: flex-start;
  }
}

.cex-cards {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

@media (max-width: 1024px) {
  .cex-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cex-cards {
    grid-template-columns: 1fr;
  }
}

.cex-cards .card {
  border-radius: 16px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  background: linear-gradient(165deg, rgba(18, 22, 28, 0.95), rgba(10, 12, 16, 0.98));
  padding: 18px 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
}

.cex-cards .card .label {
  font-size: 12px;
  color: #89a8b5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.35;
  min-height: 2.85em;
  display: flex;
  align-items: flex-end;
}

.cex-cards .card .value {
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  font-weight: 600;
  color: #fff;
  margin-top: 10px;
  font-family: var(--font-mono);
  min-height: 2.85rem;
  line-height: 1.15;
  display: flex;
  align-items: center;
  word-break: break-word;
}

.cex-cards .card .sub {
  font-size: 12px;
  color: #6a7a82;
  margin-top: auto;
  padding-top: 12px;
  line-height: 1.45;
  min-height: 3.25em;
}

.cex-cards .card:hover {
  transform: none;
  border-color: rgba(0, 212, 255, 0.28);
}

.cex-grid {
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.95fr);
  align-items: stretch;
}

@media (min-width: 1400px) {
  .cex-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(400px, 1fr);
  }
}

@media (max-width: 1200px) {
  .cex-grid {
    grid-template-columns: 1fr;
  }
}

.cex-main-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 0;
}

.cex-side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  justify-content: flex-start;
}

.cex-scoreboard-section .cex-main-col > .insights-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cex-scoreboard-section .cex-main-col > .insights-panel > .rank-list {
  flex-shrink: 0;
}

.cex-side-col > .panel {
  flex: 0 0 auto;
}

.cex-scoreboard-section .panel {
  border-radius: 18px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  background: rgba(12, 14, 18, 0.92);
  padding: 20px 22px;
  overflow: hidden;
}

.cex-scoreboard-section .panel h2 {
  margin: 0 0 6px 0;
  font-size: 1.15rem;
  color: #fff;
}

.cex-scoreboard-section .panel .hint {
  font-size: 12px;
  color: #7a8f9a;
  margin-bottom: 16px;
  line-height: 1.45;
}

.wow-good {
  color: #3dd68c;
}

.wow-bad {
  color: #ff7a7a;
}

.wow-neutral {
  color: #9aa7ad;
}

.bucket-row {
  margin-bottom: 14px;
}

.bucket-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: #c4d0d6;
}

.bucket-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.cex-scoreboard-section .notes ul {
  margin: 12px 0 0 0;
  padding: 0;
  list-style: none;
}

.cex-scoreboard-section .notes li {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 10px;
  font-size: 13px;
  color: #c8d4da;
  line-height: 1.5;
}

.cex-banner {
  margin-bottom: 16px;
}

.cex-scoreboard-section .insights-panel {
  margin: 0;
  padding: 24px 28px;
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.18));
}

.cex-scoreboard-section .cex-insights--compact {
  padding: 16px 18px;
  max-width: 100%;
}

.cex-scoreboard-section .rank-list--compact {
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 640px) {
  .cex-scoreboard-section .rank-list--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cex-scoreboard-section .insights-title {
  margin: 0;
  color: #d9f8ff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cex-scoreboard-section .rank-chart {
  height: 320px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 4px;
  align-items: end;
  padding: 14px 6px 6px 6px;
  margin: 8px 0 22px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(to top, rgba(0, 212, 255, 0.08) 1px, transparent 1px) 0 0 / 100% 20%,
    linear-gradient(180deg, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0.18));
}

.cex-scoreboard-section .rank-chart.rank-chart--compact {
  flex: 1 1 auto;
  min-height: 220px;
  height: auto;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(74px, 108px));
  column-gap: 40px;
  justify-content: center;
  padding: 10px 0 6px 0;
  margin: 6px 0 14px 0;
  align-items: stretch;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-col {
  min-height: 0;
  align-items: stretch;
  grid-template-rows: auto minmax(100px, 1fr) auto auto;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-bar-shell {
  height: 100%;
  min-height: 165px;
  align-self: stretch;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-value {
  font-size: 12px;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-entity {
  font-size: 10px;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-meta {
  font-size: 10px;
}

.cex-scoreboard-section .rank-chart.rank-chart--compact .rank-bar-vertical {
  width: min(82px, 100%);
}

.cex-scoreboard-section .rank-col {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 6px;
  align-items: end;
}

.cex-scoreboard-section .rank-value {
  text-align: center;
  color: #e8f9ff;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-mono);
}

.cex-scoreboard-section .rank-bar-shell {
  height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.cex-scoreboard-section .rank-bar-vertical {
  width: min(90px, 100%);
  min-height: 10px;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.cex-scoreboard-section .rank-col:hover .rank-bar-vertical {
  transform: translateY(-4px);
}

.cex-scoreboard-section .rank-bar-vertical.bar-1 {
  background: linear-gradient(180deg, #f8d662, #e4b328);
}

.cex-scoreboard-section .rank-bar-vertical.bar-2 {
  background: linear-gradient(180deg, #6ad7ff, #2ba6df);
}

.cex-scoreboard-section .rank-bar-vertical.bar-3 {
  background: linear-gradient(180deg, #72e9b6, #2ca37f);
}

.cex-scoreboard-section .rank-bar-vertical.bar-4 {
  background: linear-gradient(180deg, #a98eff, #6a4ce2);
}

.cex-scoreboard-section .rank-bar-vertical.bar-5 {
  background: linear-gradient(180deg, #ffb072, #d86b2e);
}

.cex-scoreboard-section .rank-entity {
  text-align: center;
  color: #dce7ed;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cex-scoreboard-section .rank-meta {
  text-align: center;
  color: #87bfd3;
  font-size: 11px;
  font-family: var(--font-mono);
}

.cex-scoreboard-section .rank-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 10px 16px;
}

.cex-scoreboard-section .rank-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #d5dfe5;
}

.cex-scoreboard-section .rank-num {
  color: #8fd9f3;
  font-family: var(--font-mono);
  text-align: right;
}

.cex-scoreboard-section .rank-bar-wrap {
  display: grid;
  gap: 5px;
}

.cex-scoreboard-section .rank-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #dce7ed;
}

.cex-scoreboard-section .rank-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.cex-scoreboard-section .rank-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00d4ff, #66e7ff);
}

.cex-scoreboard-section .rank-count {
  font-family: var(--font-mono);
  color: #9fd6df;
}

@media (max-width: 980px) {
  .cex-scoreboard-section .rank-list {
    grid-template-columns: 1fr;
  }
}
