:root {
  --bg: #f7f4ed;
  --ink: #22201d;
  --muted: #6a655f;
  --panel: #fffdf9;
  --line: #d8d2c8;
  --brand: #0f766e;
  --brand-soft: #d3f4ef;
  --leader-border: #9abbb5;
  --leader-bg-top: #f7fbf9;
  --leader-bg-bottom: #edf6f3;
  --leader-title: #1e645b;
  --leader-pill-bg: #d8ebe6;
  --leader-pill-text: #264c46;
  --leader-value: #0f766e;
  --ok: #0d9488;
  --mid: #b45309;
  --low: #b91c1c;
  --chip: #efe9de;
  --accent: #1f6feb;
  --accent-soft: #e8f0ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #efe4d0 0%, transparent 34%),
    radial-gradient(circle at 100% 0%, #d8f1ea 0%, transparent 38%),
    var(--bg);
}

.page {
  width: min(1240px, 92vw);
  margin: 28px auto 40px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.hero h1 {
  font-family: Unbounded, sans-serif;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  line-height: 1.2;
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand);
  font-weight: 800;
}

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

.scope-switch {
  display: inline-flex;
  padding: 4px;
  background: #dbeafe;
  border: 1px solid #b6ccf1;
  border-radius: 12px;
  gap: 4px;
  margin-top: 8px;
}

.scope-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  background: transparent;
  font-weight: 800;
  color: #2d4d7f;
}

.scope-btn.active {
  background: #fff;
  color: #173f79;
  box-shadow: 0 1px 3px #00000014;
}

.scope-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  background: #f0ebe2;
  border: 1px solid var(--line);
  border-radius: 12px;
  gap: 4px;
  margin-top: 8px;
  margin-left: 8px;
}

.mode-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  background: transparent;
  font-weight: 800;
  color: #444;
}

.mode-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px #00000014;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin-top: 16px;
}

.period-label {
  margin-top: -4px;
}

.subsection-title {
  margin: 12px 0 10px;
}

.leaders-strip {
  margin: 10px 0 14px;
}

.leaders-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: visible;
  padding-bottom: 0;
}

.leader-card {
  border: 1px solid var(--leader-border);
  border-radius: 28px;
  background: linear-gradient(170deg, var(--leader-bg-top), var(--leader-bg-bottom));
  padding: 10px 8px 12px;
  min-height: 142px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.leader-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7em;
  margin-top: 2px;
  color: var(--leader-title);
  font-size: clamp(0.72rem, 0.88vw, 0.92rem);
  font-weight: 800;
  line-height: 1.25;
}

.leader-pill {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 6px;
  border-radius: 999px;
  background: var(--leader-pill-bg);
  color: var(--leader-pill-text);
  font-weight: 700;
  font-size: clamp(0.60rem, 0.8vw, 0.82rem);
  text-transform: none;
  overflow: visible;
  white-space: nowrap;
}

.leader-value {
  display: block;
  margin-top: 10px;
  font-family: Unbounded, sans-serif;
  font-size: clamp(0.86rem, 1.22vw, 1.15rem);
  color: var(--leader-value);
}

.leader-note {
  display: block;
  margin-top: 10px;
  color: var(--leader-value);
  font-size: 0.84rem;
  line-height: 1.3;
  font-weight: 700;
}

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

.summary-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(170deg, #fff, #fbfaf7);
}

.summary-card h4 {
  margin: 0 0 10px;
}

.metric {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  color: var(--muted);
  gap: 10px;
}

.metric b {
  color: var(--ink);
}

.summary-card-empty {
  background: linear-gradient(170deg, #fff, #f8f6f2);
}

.metric-status {
  display: block;
}

.metric-status span {
  display: block;
  margin-bottom: 6px;
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d9cec0;
  background: #f5ede2;
  color: #67503a;
  font-size: 0.9rem;
  font-weight: 700;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 10px;
}

.cumulative-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 10px 0 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  background: var(--chip);
  font-weight: 700;
  font-size: 0.86rem;
}

.chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}

.btn-link {
  border-color: var(--accent);
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  font-size: 0.93rem;
  vertical-align: top;
}

th {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
  position: sticky;
  top: 0;
  background: var(--panel);
}

th.no-sort {
  cursor: default;
}

th.col-date,
td.col-date {
  min-width: 150px;
  white-space: nowrap;
}

th.col-er,
td.col-er,
th.col-err,
td.col-err {
  min-width: 160px;
  white-space: nowrap;
}

td.col-er .tag,
td.col-err .tag {
  margin-right: 6px;
}

a {
  color: var(--brand);
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
}

.tag.high {
  background: var(--ok);
}

.tag.mid {
  background: var(--mid);
}

.tag.low {
  background: var(--low);
}

.comments-cell {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subsection {
  margin-top: 18px;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #faf8f4;
}

.themes-panel h3 {
  margin-bottom: 8px;
}

.themes-combined-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  align-items: start;
}

.word-cloud-pane,
.clusters-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.word-cloud-pane .muted,
.clusters-pane .muted {
  margin-top: 0;
  margin-bottom: 10px;
}

.word-cloud-pane #word-cloud-source,
.clusters-pane #cluster-source {
  display: none;
}

.clusters-pane {
  min-width: 0;
}

.rubrics-panel h3 {
  margin-bottom: 8px;
}

.rubrics-combined-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  align-items: start;
}

.rubric-summary-pane {
  border: 1px solid #d8dee9;
  border-radius: 12px;
  background: #fff;
  padding: 16px 18px;
}

.content-metrics-panel h3 {
  margin-bottom: 10px;
}

.content-metrics-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  align-items: stretch;
}

.mechanics-pane,
.media-pane {
  min-width: 0;
}

.mechanics-pane {
  display: flex;
}

#mechanics-chart {
  flex: 1;
  display: flex;
}

.mechanics-pane .rubric-chart-list {
  margin-top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mechanics-pane .rubric-row {
  grid-template-columns: 166px 1fr 28px;
  margin-bottom: 0;
}

.mechanics-pane .rubric-label {
  font-size: 0.86rem;
}

.mechanics-pane .rubric-track {
  height: 30px;
}

.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.media-card {
  border: 1px solid #cfe1e5;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.media-card-wide {
  grid-column: 1 / -1;
}

.media-donut-wrap {
  position: relative;
  width: 142px;
  height: 142px;
  margin: 8px auto 2px;
}

.media-donut {
  width: 142px;
  height: 142px;
  border-radius: 999px;
  position: relative;
  box-shadow: 0 0 0 1px #c9dde2 inset;
}

.media-donut::after {
  content: "";
  position: absolute;
  inset: 21px;
  border-radius: 999px;
  background: #fff;
}

.media-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 1;
  line-height: 1.2;
}

.media-donut-center b {
  font-size: 1.02rem;
}

.media-donut-center span {
  font-size: 0.8rem;
  color: var(--muted);
}

.media-legend {
  display: grid;
  gap: 4px;
}

.media-legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  column-gap: 6px;
  font-size: 0.84rem;
}

.media-legend-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.media-legend-label {
  color: #3f3a33;
}

.media-legend-pct {
  color: var(--muted);
}

.media-note {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.mix-list {
  display: grid;
  gap: 6px;
}

.mix-row {
  border: 1px solid #d6e4e8;
  border-radius: 10px;
  background: #f8fcfd;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
}

.mix-row b {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: #d7ecef;
  color: #1f6f7f;
  font-size: 0.78rem;
}

.rubrics-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.posting-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.posting-list {
  margin-top: 10px;
}

.posting-row {
  display: grid;
  grid-template-columns: 88px 1fr 30px;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
}

.posting-label {
  font-size: 0.92rem;
  color: var(--muted);
}

.posting-track {
  height: 30px;
  border: 1px solid #d5dce5;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.posting-fill {
  height: 100%;
  background: linear-gradient(90deg, #8bb7d5, #6ea5c9);
  border-right: 1px solid #4f88ad;
}

.posting-count {
  font-weight: 800;
}

.rubric-chart-list {
  margin-top: 10px;
}

.rubric-chart-select {
  margin-top: 8px;
}

.rubric-row {
  display: grid;
  grid-template-columns: 220px 1fr 30px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.rubric-row-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  padding: 2px 4px;
  transition: background-color 140ms ease;
}

.rubric-row-btn:hover {
  background: #e9f3f4;
}

.rubric-row-btn.active {
  background: #dff0f2;
}

.rubric-focus-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 2px 6px;
  display: grid;
  gap: 14px;
  font-size: 0.92rem;
}

.rubric-focus-card p {
  margin: 0;
  line-height: 1.52;
  text-wrap: pretty;
}

.rubric-label {
  font-size: 0.95rem;
  color: var(--muted);
}

.rubric-row-btn.active .rubric-label {
  color: #1f6f7f;
  font-weight: 800;
}

.rubric-track {
  height: 38px;
  border: 1px solid #bdd5da;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.rubric-row-btn:hover .rubric-track {
  border-color: #9fc5cc;
}

.rubric-row-btn.active .rubric-track {
  border-color: #7db2bc;
  box-shadow: 0 0 0 2px #d5eaee inset;
}

.rubric-fill {
  height: 100%;
  background: linear-gradient(90deg, #78aec0, #6ea2b4);
  border-right: 1px solid #5a8696;
}

.rubric-count {
  font-weight: 800;
}

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

.cluster-card {
  border: 1px solid #d8dee9;
  border-radius: 12px;
  padding: 16px 16px 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cluster-card-head {
  position: relative;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 34px;
  padding-right: 44px;
}

.cluster-card-head h4 {
  margin: 0;
  font-size: 1.07rem;
  text-align: left;
  line-height: 1.25;
  text-wrap: balance;
}

.cluster-card-count {
  position: absolute;
  right: 0;
  top: 0;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #d7ecef;
  color: #256f7b;
  font-size: 0.83rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.cluster-insight {
  margin: 0;
  color: #35322d;
  font-size: 0.92rem;
  line-height: 1.52;
  text-wrap: pretty;
}

.cluster-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

.cluster-card-actions .btn-link {
  width: 100%;
  text-align: center;
  padding: 10px 12px;
  border: 0;
  background: linear-gradient(180deg, #d7ecef, #c3e0e5);
  color: #1f6f7f;
  box-shadow: inset 0 -1px 0 #9fc5cc;
  font-size: 0.92rem;
}

.cluster-card-actions .btn-link:hover {
  background: linear-gradient(180deg, #cbe6ea, #b7d9df);
}

.accordion {
  border: 1px solid #d8dee9;
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 12px;
  font-weight: 700;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion[open] summary {
  background: #adc1df;
  color: #173f79;
}

.accordion-body {
  padding: 12px;
}

.preview {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
}

.view-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cumulative-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.cumulative-head-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 14px;
  align-items: stretch;
}

.cumulative-head-grid > .subpanel {
  display: flex;
  flex-direction: column;
}

.cumulative-head-grid > .subpanel > #cumulative-avg-er {
  flex: 1;
  display: flex;
}

.cumulative-head-grid > .subpanel > #cumulative-avg-er .avg-er-list {
  width: 100%;
  height: 100%;
}

.avg-er-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.avg-er-row {
  display: grid;
  grid-template-columns: 1.15fr 0.65fr 0.75fr 0.35fr;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #ece7df;
  font-size: 0.9rem;
  align-items: center;
}

.avg-er-row:last-child {
  border-bottom: 0;
}

.avg-er-head {
  background: #f7f3ea;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 700;
}

.avg-er-value {
  font-weight: 800;
  color: var(--accent);
}

.avg-er-value.tgstat {
  color: #0f766e;
}

.top-post-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-post-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.top-post-er {
  font-weight: 800;
  color: var(--accent);
}

.top-post-er.alt {
  color: #0f766e;
}

.top-post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top-post-topic {
  margin: 0;
  line-height: 1.38;
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-post-card .btn-link,
.bucket-post-card .btn-link {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 8px 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.trend-chart {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  align-items: end;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 250px;
}

.compact-subpanel .posting-list {
  margin-top: 0;
}

.cumulative-publication-grid-top {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.cumulative-publication-grid-top > .subpanel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.compact-subpanel h3 {
  margin-bottom: 4px;
}

.compact-subpanel > .muted {
  margin: 0 0 10px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.compact-weekday-panel #cumulative-weekday-chart {
  flex: 1;
  display: flex;
  min-height: 0;
}

#cumulative-weekday-chart .trend-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-height: 246px;
  height: 100%;
  padding: 8px;
  overflow-x: hidden;
}

#cumulative-weekday-chart .trend-col {
  min-width: 0;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

#cumulative-weekday-chart .trend-bar-wrap {
  height: 100%;
}

#cumulative-weekday-chart .trend-col-label {
  font-size: 0.73rem;
}

#cumulative-hour-chart {
  overflow-x: hidden;
}

#cumulative-hour-chart .trend-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  width: 100%;
  min-height: 220px;
  padding: 8px;
  gap: 4px;
  overflow-x: hidden;
}

#cumulative-hour-chart .trend-col {
  min-width: 0;
  grid-template-rows: 126px auto auto;
}

#cumulative-hour-chart .trend-bar-wrap {
  height: 126px;
}

#cumulative-hour-chart .trend-col-label {
  font-size: 0.58rem;
  white-space: pre-line;
  line-height: 1.02;
}

#cumulative-hour-chart .trend-col-value {
  font-size: 0.68rem;
}

.trend-col {
  min-width: 72px;
  display: grid;
  grid-template-rows: 170px auto auto;
  gap: 4px;
}

.trend-bar-wrap {
  display: flex;
  align-items: end;
  height: 170px;
}

.trend-bar {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #7eb6d8 0%, #4f88ad 100%);
}

.trend-bar-er {
  background: linear-gradient(180deg, #7f9cf0 0%, #4f63c4 100%);
}

.trend-bar.clickable {
  cursor: pointer;
}

.trend-bar.peak {
  box-shadow: 0 0 0 2px #fdba74 inset;
}

#cumulative-weekday-chart .trend-bar.peak,
#cumulative-hour-chart .trend-bar.peak {
  box-shadow: none;
  background: linear-gradient(180deg, #6ad5cc 0%, #1a978e 100%);
}

.trend-col-label {
  font-size: 0.77rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-col-value {
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.trend-col-subvalue {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.15;
}

.trend-col-meta {
  font-size: 0.68rem;
  color: #8a847b;
  text-align: center;
}

.trend-bar.low-confidence {
  opacity: 0.45;
  filter: grayscale(0.2);
}

.trend-legend {
  margin: 12px 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.trend-source-note a {
  color: #1f6feb;
  text-decoration: underline;
}

.line-trend-head {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.line-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--muted);
}

.line-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.line-legend .dot.selected {
  background: #1d4ed8;
}

.line-legend .dot.market {
  background: #0f766e;
}

.line-trend-wrap {
  overflow-x: auto;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 6px 8px 2px;
}

.line-trend-svg {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
}

.line-grid {
  stroke: #e8e2d8;
  stroke-width: 1;
}

.line-y-label {
  fill: #8d867e;
  font-size: 10px;
  text-anchor: end;
}

.line-x-label {
  fill: #8d867e;
  font-size: 10px;
  text-anchor: middle;
}

.line-market-path {
  fill: none;
  stroke: #0f766e;
  stroke-width: 2;
  opacity: 0.8;
}

.line-selected-path {
  fill: none;
  stroke: #1d4ed8;
  stroke-width: 2.4;
}

.line-market-point {
  fill: #0f766e;
  opacity: 0.9;
}

.line-selected-point {
  fill: #1d4ed8;
  stroke: #fff;
  stroke-width: 1.4;
  cursor: pointer;
}

.line-selected-point.low-confidence {
  opacity: 0.45;
}

#cumulative-er-source-switch {
  margin-bottom: 10px;
}

#cumulative-top-filters {
  margin-top: 4px;
  margin-bottom: 12px;
}

#cumulative-top-posts {
  margin-top: 4px;
}

#cumulative-er-filters {
  margin-top: 4px;
  margin-bottom: 12px;
  gap: 6px;
}

#cumulative-er-filters .chip {
  padding: 6px 10px;
  font-size: 0.82rem;
}

#cumulative-top-filters .chip {
  padding: 6px 10px;
  font-size: 0.82rem;
}

#cumulative-top-filters .chip-all-competitors {
  border-color: #8db7ff;
  background: #edf4ff;
  color: #214b84;
}

#cumulative-top-filters .chip-all-competitors.active {
  border-color: #0f766e;
  background: #d3f4ef;
  color: #124740;
}

#cumulative-er-filters .chip-all-competitors {
  border-color: #8db7ff;
  background: #edf4ff;
  color: #214b84;
}

#cumulative-er-filters .chip-all-competitors.active {
  border-color: #0f766e;
  background: #d3f4ef;
  color: #124740;
}

.interaction-chip-list {
  margin-bottom: 10px;
}

#cumulative-interaction-sort {
  margin-bottom: 12px;
}

#cumulative-top-interactions {
  margin-top: 4px;
}

.top-post-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.popular-month-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.popular-month-row {
  display: grid;
  grid-template-columns: 1fr 0.35fr;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #ece7df;
}

.popular-month-row:last-child {
  border-bottom: 0;
}

.popular-month-head {
  background: #f7f3ea;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  font-size: 0.77rem;
}

.popular-month-month {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.popular-month-count {
  text-align: right;
  font-weight: 800;
  color: #0f766e;
}

.popular-month-head span:last-child {
  text-align: right;
}

.popular-month-row span {
  font-size: 0.82rem;
}

.channel-top-month-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.channel-top-month-row {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr 0.3fr;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #ece7df;
}

.channel-top-month-row:last-child {
  border-bottom: 0;
}

.channel-top-month-head {
  background: #f7f3ea;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  font-size: 0.77rem;
}

.channel-top-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.channel-top-month {
  font-size: 0.8rem;
}

.channel-top-count {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f766e;
  text-align: right;
}

.word-cloud {
  border: 1px dashed var(--line);
  border-radius: 14px;
  min-height: 360px;
  height: clamp(360px, 34vw, 520px);
  max-height: 520px;
  padding: 0;
  background: #fff;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.word {
  position: absolute;
  transform: translate(-50%, -50%);
  line-height: 1.05;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 1px 0 #ffffffb0;
}

.word-center {
  font-family: Unbounded, sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.word-cloud > .empty {
  position: absolute;
  inset: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.simple-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

#recommendations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.recommendations-panel h3 {
  margin-bottom: 10px;
}

.recommend-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.recommend-card h4 {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #4099a9, #2f7f8f);
  color: #fff;
  line-height: 1.28;
  font-size: 1rem;
  text-wrap: balance;
}

.recommend-text {
  margin: 0;
  line-height: 1.5;
  font-size: 0.98rem;
  text-wrap: pretty;
}

.recommend-meta-grid {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #e6e1d8;
  display: grid;
  gap: 6px;
  min-height: 160px;
}

.recommend-meta-row {
  margin: 0;
  line-height: 1.35;
  text-wrap: pretty;
  display: block;
}

.recommend-meta-row b {
  font-weight: 800;
}

.recommend-meta-row-type {
  min-height: 1.5em;
}

.recommend-meta-row-rubric {
  min-height: 2.8em;
}

.recommend-meta-row-format {
  min-height: 2.8em;
}

.recommend-id-link {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: #1f6f7f;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.recommend-id-link:hover {
  color: #155561;
}

.recommend-id-link:focus-visible {
  outline: 2px solid #7cb1bc;
  outline-offset: 2px;
  border-radius: 4px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--muted);
  background: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: #0000005c;
}

.modal-card {
  position: relative;
  width: min(1320px, 96vw);
  max-height: 94vh;
  overflow: auto;
  border-radius: 22px;
  background: #f7f7f7;
  border: 1px solid #d6d6d6;
  padding: 24px;
}

.modal-card-narrow {
  width: min(880px, 95vw);
}

.modal-close {
  border: 0;
  background: #fff;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 2.35rem;
  line-height: 1;
  color: #7d7d7d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-weight: 400;
  z-index: 3;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.7fr 0.8fr;
  gap: 14px;
}

.modal-title {
  margin-bottom: 12px;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.modal-text {
  border: 1px solid #d9d9d9;
  border-radius: 12px;
  padding: 18px;
  background: #efefef;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-text-head {
  display: block;
  margin-bottom: 6px;
}

.modal-comments {
  margin-top: 12px;
  border: 1px solid #d2d8df;
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

.modal-comments h4 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.modal-comments ul {
  margin: 0;
  padding-left: 20px;
}

.modal-comments li {
  margin-bottom: 10px;
}

.modal-side {
  display: grid;
  gap: 0;
  align-content: start;
  margin-top: 10px;
}

.modal-er {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 20px 22px;
  display: grid;
  margin-bottom: 14px;
}

.modal-er span {
  font-size: 1.05rem;
}

.modal-er b {
  font-size: 3rem;
  line-height: 1;
}

.modal-metric {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #d0d7de;
  font-size: 1.05rem;
}

.modal-metric b {
  text-align: right;
}

.modal-link {
  margin-top: 14px;
  text-align: center;
  border-color: var(--accent);
  color: var(--accent);
  font-size: 1.25rem;
  padding: 12px;
  background: transparent;
}

.hidden {
  display: none;
}

.bucket-post-list {
  display: grid;
  gap: 10px;
}

.bucket-post-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.bucket-post-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 1060px) {
  .cumulative-head-grid {
    grid-template-columns: 1fr;
  }

  .cumulative-publication-grid-top {
    grid-template-columns: 1fr;
  }

  .rubrics-layout {
    grid-template-columns: 1fr;
  }

  .rubrics-combined-grid {
    grid-template-columns: 1fr;
  }

  .themes-combined-grid {
    grid-template-columns: 1fr;
  }

  .word-cloud {
    min-height: 320px;
    height: clamp(320px, 46vw, 430px);
    max-height: 430px;
  }

  .content-metrics-grid {
    grid-template-columns: 1fr;
  }

  #recommendations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-grid {
    grid-template-columns: 1fr 1fr;
  }

  .posting-layout {
    grid-template-columns: 1fr;
  }

  .rubric-row {
    grid-template-columns: 160px 1fr 30px;
  }

  .mechanics-pane .rubric-row {
    grid-template-columns: 140px 1fr 28px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-side {
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .scope-switch,
  .mode-switch {
    margin-left: 0;
    display: flex;
  }

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

  .rubric-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .rubric-track {
    height: 24px;
  }

  .word-cloud {
    min-height: 280px;
    height: 320px;
    max-height: none;
  }

  #recommendations {
    grid-template-columns: 1fr;
  }

  .recommend-card {
    padding: 15px;
    gap: 12px;
  }

  .recommend-meta-grid {
    min-height: 0;
  }

  .recommend-meta-row-type,
  .recommend-meta-row-rubric,
  .recommend-meta-row-format {
    min-height: 0;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }

  .media-card-wide {
    grid-column: auto;
  }

  .media-donut-wrap,
  .media-donut {
    width: 126px;
    height: 126px;
  }

  .media-donut::after {
    inset: 18px;
  }

  .modal-card {
    padding: 14px;
    border-radius: 14px;
  }

  .modal-er b {
    font-size: 2.2rem;
  }

  .avg-er-row {
    grid-template-columns: 1fr 0.7fr 0.75fr 0.35fr;
    font-size: 0.84rem;
  }

  .trend-col {
    min-width: 58px;
  }

  .trend-chart {
    min-height: 220px;
    padding: 8px;
  }

  .cumulative-publication-grid-top {
    grid-template-columns: 1fr;
  }

  .leaders-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
  }

  .leader-card {
    min-height: 136px;
    border-radius: 20px;
    padding: 8px 6px 9px;
  }

  .leader-pill {
    font-size: clamp(0.56rem, 1.55vw, 0.74rem);
    padding: 7px 4px;
  }

  .leader-value {
    font-size: clamp(0.78rem, 2.1vw, 0.95rem);
  }

  .popular-month-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .popular-month-month {
    white-space: normal;
  }

  .popular-month-count,
  .popular-month-head span:last-child {
    text-align: left;
  }

  .channel-top-month-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .channel-top-count,
  .channel-top-month-head span:last-child {
    text-align: left;
  }
}
