:root {
  /* Station palette */
  --main-color: #7800ff;
  --main-color-light: #d9b8ff;
  --main-color-dark: #5200ad;
  --primary-button-color: #6500d6;
  --primary-text-color: #2b005c;
  --bg-color-main: #f4f5f6;
  --cov-color: #ebaf00; /* Pantone 2314: matched-passage marker */

  --bg: #ffffff;
  --surface: #f4f5f6;
  --border: #eaecf0;
  --text: #1a2027;
  --muted: #787878;
  --radius: 5px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-color-main);
  color: var(--muted);
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

/* ---- Two-column layout ---- */
.layout {
  display: flex;
  gap: 10px;
  align-items: stretch;
  height: 100vh;
  padding: 10px;
  overflow: hidden;
}
.left {
  flex: 0 0 400px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 5px;
}
.right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow-y: auto;
  padding-bottom: 16px;
}
.right-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Panels (Kendo-like rounded white boxes) ---- */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search-panel {
  padding: 10px;
  flex: 0 0 auto;
}
.list-panel {
  padding: 6px 4px 6px 10px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: solid #fff 5px;
}

/* ---- Search + date filters ---- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  pointer-events: none;
}
.search-box .st-input { padding-left: 34px; }

.st-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.st-input:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 3px var(--main-color-light);
}

.date-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.date-field {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.date-field > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

/* ---- Press-release list ---- */
.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 10px 8px 2px;
  flex: 0 0 auto;
}
.list-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.list-count { font-size: 0.8rem; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.list-header { align-items: center; gap: 8px; }
.sort-wrap { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.sort-label { font-size: 0.75rem; color: var(--muted); }
.sort-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
}
.sort-toggle button {
  font: inherit;
  font-size: 0.75rem;
  padding: 3px 8px;
  border: 0;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.sort-toggle button + button { border-left: 1px solid var(--border); }
.sort-toggle button:hover { background: var(--bg-color-main); }
.sort-toggle button.active { background: var(--main-color); color: #fff; }
.pr-time { color: var(--muted); }

.pr-list {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.pr-list li {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
  cursor: pointer;
  transition: background-color 0.12s;
}
.pr-list li:hover { background: var(--bg-color-main); }
.pr-list li:last-child { border-bottom: none; }

.pr-title {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 3px;
}
.pr-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.pr-badge {
  display: inline-block;
  background: var(--main-color);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 8px;
}

/* ---- Chart cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  height: 320px;
}
.card-row {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.card-row > .card { min-width: 0; }
.card-wide { flex: 2 1 0; }
.card-narrow { flex: 1 1 0; }
.card-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--primary-text-color);
  font-weight: 700;
  font-size: 0.95rem;
}
.card-body {
  flex: 1 1 auto;
  padding: 10px 12px;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.card-footnote {
  flex: 0 0 auto;
  padding: 6px 14px 10px;
  color: var(--secondary-text-color, #6b6b6b);
  font-size: 0.85rem;
}

/* ---- SVG charts ---- */
/* Absolutely positioned so the SVG never feeds its own size back into the
   flex layout (which caused a ResizeObserver -> re-render growth loop). */
.chart { position: absolute; inset: 10px 12px; width: auto; height: auto; display: block; }
.chart .axis { stroke: #8e8e8e; stroke-width: 1; }
.chart .grid { stroke: #dfdfdf; stroke-width: 1; }
.chart .axis-label { fill: #232323; font: 12px Arial, Helvetica, sans-serif; }
.chart .tick-label { fill: #232323; font: 12px Arial, Helvetica, sans-serif; }
.chart .trend-line { fill: none; stroke: var(--main-color); stroke-width: 1.5; stroke-linejoin: round; }
.chart .trend-area { fill: none; }
.chart .trend-dot { fill: #fff; stroke: var(--main-color); stroke-width: 2; }
.chart .bar { fill: var(--main-color); transition: opacity 0.12s, fill 0.12s; }
.chart .bench-line { fill: none; stroke: #f59e0b; stroke-width: 1.5; stroke-dasharray: 5 3; stroke-linejoin: round; }
.chart .bench-dot { fill: #fff; stroke: #f59e0b; stroke-width: 2; }
.chart .legend-label { fill: #232323; font: 11px Arial, Helvetica, sans-serif; }
.chart .slice { stroke: #fff; stroke-width: 1; }
.chart .slice-coverage { fill: var(--main-color); }
.chart .slice-coverage:hover { fill: var(--main-color-dark); }
.chart .slice-other { fill: #c4c4c4; }
.chart .slice-other:hover { fill: #adadad; }
.chart .leader { fill: none; stroke: #999; stroke-width: 2; }
.chart .slice-label { fill: #232323; font: 12px Arial, Helvetica, sans-serif; }
.chart .donut-total { fill: var(--primary-text-color); font: 700 18px "Mulish", sans-serif; }
.chart .donut-total-label { fill: var(--muted); font: 11px Arial, Helvetica, sans-serif; }

/* ---- Chart hover highlight ---- */
.chart .hit { fill: transparent; }
.chart .focus-guide {
  stroke: var(--main-color-light); stroke-width: 1; stroke-dasharray: 3 3;
  opacity: 0; pointer-events: none;
}
.chart .focus-dot {
  fill: var(--main-color); stroke: #fff; stroke-width: 2;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.chart .focus-dot.focus-bench { fill: #f59e0b; }
.chart .focus-guide.hl,
.chart .focus-dot.hl { opacity: 1; }
.chart.has-hl .bar { opacity: 0.35; }
.chart.has-hl .bar.hl { opacity: 1; fill: var(--main-color-dark); }
.chart .tick-label.hl,
.chart .slice-label.hl { fill: var(--primary-text-color); font-weight: 700; }
.chart .slice { transition: opacity 0.12s, transform 0.15s ease-out; }
.chart.has-hl .slice { opacity: 0.5; }
.chart.has-hl .slice.hl { opacity: 1; transform: translate(var(--pop-x, 0), var(--pop-y, 0)); }

/* ---- Chart tooltip (shared, follows the pointer) ---- */
.chart-tip {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  min-width: 140px;
  max-width: 260px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--main-color);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(43, 0, 92, 0.14), 0 1px 3px rgba(16, 24, 40, 0.08);
  font-family: "Mulish", sans-serif;
  font-size: 0.8rem;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.1s, transform 0.1s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip .tip-title {
  color: var(--primary-text-color);
  font-weight: 700;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.5; }
.chart-tip .tip-label { color: var(--muted); flex: 1 1 auto; }
.chart-tip .tip-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .tip-swatch { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.chart-tip .sw-main { background: var(--main-color); }
.chart-tip .sw-bench { background: #f59e0b; }
.chart-tip .sw-other { background: #c4c4c4; }

/* ---- States ---- */
.empty { color: var(--muted); font-style: italic; padding: 8px 6px; }
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
}
.unauthorized {
  text-align: center;
  color: var(--muted);
  padding: 48px 24px;
  font-style: italic;
}

/* ---- Modal (press-release popup) ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, 0.45); }
.modal-panel {
  position: relative;
  background: var(--bg);
  border-radius: 0;
  max-width: none;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  box-shadow: none;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
}
.modal-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}
.modal-close:hover { color: var(--text); }
.modal-content h2 { margin: 0 8px 6px 0; font-size: 1.25rem; padding-right: 28px; color: var(--text); }
.modal-content .item-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }
.pr-head h2 { margin: 0 8px 6px 0; font-size: 1.25rem; color: var(--text); }
.pr-head .item-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.modal-body { white-space: pre-wrap; line-height: 1.65; color: var(--text); }
.modal-section {
  margin: 22px 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.art-list li {
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
}
.art-list li:last-child { border-bottom: none; }
.art-list a {
  color: var(--main-color);
  text-decoration: none;
  font-weight: 600;
}
.art-list a:hover { text-decoration: underline; }
.art-list .item-meta { color: var(--muted); font-size: 0.82rem; }
.modal-articles { margin-top: 8px; }

/* ---- Press-release popup: front-page-style two-column layout ---- */
.pr-head {
  margin-bottom: 14px;
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.pr-head-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pr-head-top h2 { margin: 0; }
.pr-back {
  align-self: flex-start;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.pr-back svg { display: block; }
.pr-back:hover {
  color: var(--main-color);
  border-color: var(--main-color-light);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}
.pr-body-toggle { margin-top: 10px; }
.pr-body-toggle > summary {
  cursor: pointer;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--main-color);
  font-weight: 700;
  list-style: none;
}
.pr-body-toggle > summary::-webkit-details-marker { display: none; }
.pr-body-toggle > summary::before { content: "▸ "; }
.pr-body-toggle[open] > summary::before { content: "▾ "; }
.pr-body-toggle .modal-body {
  margin-top: 10px;
  max-height: 30vh;
  overflow-y: auto;
  padding-right: 6px;
}

.pr-layout {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}
.pr-left {
  flex: 0 0 400px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.pr-right {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow-y: auto;
}
.pr-left .list-panel { border-left: none; }
.cov-list li { cursor: default; }
.cov-list .cov-title { color: var(--text); text-decoration: none; }
.cov-list .cov-title:hover { text-decoration: underline; }
.cov-list li.active { background: var(--bg-color-main); box-shadow: inset 3px 0 0 var(--main-color); }

/* ---- Coverage article (replaces the detail charts) ---- */
.pr-charts { display: flex; flex-direction: column; gap: 8px; }
.pr-article { padding: 14px 18px 20px; }
.art-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.art-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
}

/* Body on the left, Station-style meta column + tags on the right. */
.art { display: flex; gap: 18px; align-items: flex-start; }
.art-main { flex: 1 1 auto; min-width: 0; }
.art-side {
  flex: 0 0 190px;
  max-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
}
.art-meta {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--text);
}
.art-meta-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.art-meta-label.art-paid { color: #b45309; }
.art-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.6;
  min-width: 0;
}
.art-meta-row svg { flex: 0 0 auto; }
.art-meta-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-kws { display: flex; flex-wrap: wrap; gap: 6px; }
.art-kw {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--main-color-light);
  color: var(--primary-text-color);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  padding: 1px 6px;
  cursor: pointer;
}
.art-kw:hover { background: #cba0ff; }
.art-kw:disabled { cursor: default; opacity: 0.6; }
.art-kw:disabled:hover { background: var(--main-color-light); }
.art-kw-count {
  background: #fff;
  color: var(--main-color-dark);
  border-radius: 8px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.art-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 0.85rem; }
.art-links a {
  color: var(--main-color);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--main-color-light);
  border-radius: 8px;
  padding: 4px 10px;
  background: #fff;
}
.art-links a:hover { border-color: var(--main-color); }
.art-player { margin-bottom: 12px; }
.art-player video {
  display: block;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
}
.art-player audio { display: block; width: 100%; max-width: 640px; }
.art-body {
  color: var(--text);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.art-body p { margin: 0 0 0.9em; }
/* Radio/TV transcript: scroll box that follows playback. */
.art-transcript {
  position: relative; /* word offsetTop is measured against this box */
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.art-transcript .tc { cursor: pointer; border-radius: 3px; transition: background 0.15s; }
.art-transcript .tc:hover { background: var(--bg-color-main); }
.art-transcript .tc.tc-now { background: var(--main-color-light); color: var(--primary-text-color); }
.art-body a { color: var(--main-color); }
.art-body .kw-hl {
  background: rgba(0, 117, 205, 0.15);
  border-bottom: 1px solid rgba(0, 117, 205, 0.25);
  border-radius: 2px;
  padding: 1px 0;
}
/* Hit jumped to from a sidebar tag. */
.art-body .kw-focus { outline: 2px solid var(--main-color); outline-offset: 1px; }
/* Bar in the left gutter beside the passage the coverage match was made on;
   its ends fade over --fade (set per bar in JS). */
.art-body.has-cov-bar { position: relative; padding-left: 14px; }
.cov-bar {
  position: absolute;
  left: 3px;
  width: 4px;
  border-radius: 2px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--cov-color) var(--fade),
    var(--cov-color) calc(100% - var(--fade)),
    transparent
  );
}
.cov-bar-anchor { position: absolute; left: 0; width: 1px; visibility: hidden; }
/* Station's paid-content blur. */
.art-body .blur { text-shadow: 0 0 5px black; color: transparent; user-select: none; }

/* ---- Responsive: stack columns ---- */
@media (max-width: 900px) {
  .layout { flex-direction: column; height: auto; overflow: visible; }
  .left { flex: 1 1 auto; max-width: none; }
  .right { overflow: visible; }
  .card-row { flex-direction: column; }
  .pr-list { max-height: 420px; }
  .pr-layout { flex-direction: column; height: auto; }
  .pr-left { flex: 1 1 auto; max-width: none; }
  .art { flex-direction: column-reverse; }
  .art-side { flex: 1 1 auto; max-width: none; position: static; }
}
