/* AV DS 4.6 data primitives · QRadio editorial/audiophile profile */

[data-avds-primitive] {
  --avds-data-line: rgba(23, 33, 31, .16);
  --avds-data-muted: #68736e;
  --avds-data-surface: #f7f8f5;
  --avds-data-accent: #78988a;
  --avds-data-strong: #17211f;
}

/* FacetGrid: compact specification and live station readouts. Keep each value
   legible as a discrete editorial facet instead of a generic KPI tile. */
.hero-proof[data-avds-primitive="FacetGrid"],
.hero-proof[data-avds-primitive="PublicSummaryStrip"],
.station-mini-metrics[data-avds-primitive="FacetGrid"] {
  position: relative;
}
.hero-proof[data-avds-primitive="FacetGrid"]::before,
.hero-proof[data-avds-primitive="PublicSummaryStrip"]::before,
.station-mini-metrics[data-avds-primitive="FacetGrid"]::before {
  content: "FACET GRID";
  position: absolute;
  top: -.55rem;
  right: 0;
  color: var(--avds-data-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .38rem;
  letter-spacing: .12em;
}
.hero-proof[data-avds-primitive="FacetGrid"] div,
.hero-proof[data-avds-primitive="PublicSummaryStrip"] div,
.station-mini-metrics[data-avds-primitive="FacetGrid"] > div {
  position: relative;
  transition: background .2s ease, border-color .2s ease;
}
.hero-proof[data-avds-primitive="FacetGrid"] div:hover,
.hero-proof[data-avds-primitive="PublicSummaryStrip"] div:hover,
.station-mini-metrics[data-avds-primitive="FacetGrid"] > div:hover {
  background: color-mix(in srgb, var(--avds-data-surface) 78%, var(--avds-data-accent));
  border-color: color-mix(in srgb, var(--avds-data-line) 55%, var(--avds-data-accent));
}
.hero-proof[data-avds-primitive="FacetGrid"] dt,
.hero-proof[data-avds-primitive="PublicSummaryStrip"] dt,
.station-mini-metrics[data-avds-primitive="FacetGrid"] dt {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.hero-proof[data-avds-primitive="FacetGrid"] dt::before,
.hero-proof[data-avds-primitive="PublicSummaryStrip"] dt::before,
.station-mini-metrics[data-avds-primitive="FacetGrid"] dt::before {
  content: "";
  width: .28rem;
  height: .28rem;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.avds-primitive-label {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  color: var(--avds-data-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .46rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.avds-primitive-label::before {
  content: "";
  width: .35rem;
  height: .35rem;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.avds-data-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--avds-data-line);
}
.avds-data-head h3 {
  margin: .28rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
}
.avds-data-head > small {
  color: var(--avds-data-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .47rem;
  text-align: right;
}

/* DataFreshness: every live surface has an explicit loading/live/stale/error state. */
.data-state-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  margin: .9rem 0 .7rem;
  padding: .65rem .75rem;
  border: 1px solid var(--avds-data-line);
  background: rgba(247, 248, 245, .76);
}
.data-state-mark { width: .55rem; height: .55rem; border: 1px solid currentColor; border-radius: 50%; color: var(--avds-data-muted); }
.data-state-banner > div { min-width: 0; }
.data-state-banner strong { display: block; color: var(--avds-data-strong); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .52rem; letter-spacing: .04em; text-transform: uppercase; }
.data-state-banner small { display: block; margin-top: .18rem; color: var(--avds-data-muted); font-size: .56rem; }
.data-state-banner .text-button { white-space: nowrap; }
.data-state-banner.is-loading .data-state-mark { color: var(--brass); animation: avdsPulse 1.1s ease-in-out infinite alternate; }
.data-state-banner.is-live .data-state-mark { color: #5a7a61; background: #5a7a61; }
.data-state-banner.is-stale { border-color: rgba(157, 56, 46, .32); background: #f2e9df; }
.data-state-banner.is-stale .data-state-mark { color: var(--red); background: var(--red); }
.data-state-banner.is-error { border-color: rgba(157, 56, 46, .48); background: #f5e4de; }
.data-state-banner.is-error .data-state-mark { color: var(--red); background: var(--red); }
.data-state-banner.is-locked { border-color: rgba(27, 26, 24, .22); background: #ebe5da; }
.data-state-banner.is-locked .data-state-mark { color: #706b62; background: #706b62; }
@keyframes avdsPulse { from { opacity: .35; transform: scale(.82); } to { opacity: 1; transform: scale(1.08); } }

/* TreemapStrip: part-to-whole runway of the real playlist. */
.station-data-stack { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(18rem, .65fr); gap: .65rem; }
.station-data-stack .avds-treemap-card { grid-column: 1; }
.station-data-stack .avds-calendar-card { grid-column: 2; }
.station-data-stack .avds-spark-card { grid-column: 1 / -1; }
.avds-treemap-card,
.avds-calendar-card,
.station-language-compare {
  padding: .8rem;
  border: 1px solid var(--avds-data-line);
  background: var(--avds-data-surface);
}
.queue-pulse-bars {
  min-height: 7.5rem;
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-top: .8rem;
  overflow: hidden;
  background: #d2ded8;
}
.queue-pulse-bars > span {
  position: relative;
  min-width: 4px;
  display: flex;
  align-items: flex-end;
  padding: .35rem;
  background: #6f9383;
  border: 0;
  transition: flex-grow .35s ease, filter .2s ease;
}
.queue-pulse-bars > span:nth-child(3n+2) { background: #9cbcaf; }
.queue-pulse-bars > span:nth-child(3n+3) { background: #4e6e65; }
.queue-pulse-bars > span.is-current {
  background: #b45f4d;
  box-shadow: inset 0 0 0 2px #edf4ef;
}
.queue-pulse-bars > span b {
  color: rgba(255,255,255,.82);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .42rem;
  font-weight: 700;
}
.queue-pulse-bars > span.is-empty { width: 100%; min-height: 7.5rem; background: #d2ded8; }

/* CalendarHeatmap: explicitly limited to the last 12 queued stories. */
.queue-rhythm-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .28rem;
  margin-top: .75rem;
}
.queue-rhythm-day {
  min-height: 3.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .42rem;
  border: 1px solid var(--avds-data-line);
  background: #e8eeea;
}
.queue-rhythm-day[data-level="1"] { background: #d8e5de; }
.queue-rhythm-day[data-level="2"] { background: #b4cdbf; }
.queue-rhythm-day[data-level="3"] { background: #7b9e8d; color: #17211f; }
.queue-rhythm-day[data-level="4"] { background: #2e5b55; color: #eff5f0; }
.queue-rhythm-day span,
.queue-rhythm-day small {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .42rem;
  text-transform: uppercase;
}
.queue-rhythm-day strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; font-weight: 400; }
.queue-rhythm-legend { display: flex; align-items: center; gap: .4rem; margin-top: .55rem; color: var(--avds-data-muted); font-size: .48rem; }
.queue-rhythm-legend i { width: .55rem; height: .55rem; display: inline-block; background: #e8eeea; border: 1px solid var(--avds-data-line); }
.queue-rhythm-legend i:nth-of-type(2) { background: #b4cdbf; }
.queue-rhythm-legend i:nth-of-type(3) { background: #2e5b55; }

/* TrendSparkline: a compact seven-day intake line paired with CalendarHeatmap. */
.avds-spark-card {
  padding: .8rem;
  border: 1px solid var(--avds-data-line);
  background: #edf2ee;
}
.queue-trend {
  position: relative;
  min-height: 6.5rem;
  margin-top: .72rem;
  padding: .2rem 0;
  overflow: hidden;
  background: linear-gradient(to bottom, transparent 0 49%, rgba(27, 26, 24, .08) 49% 50%, transparent 50% 100%);
}
.queue-trend svg { display: block; width: 100%; height: 6.1rem; overflow: visible; }
.queue-trend-area { fill: rgba(120, 152, 138, .2); }
.queue-trend-line { fill: none; stroke: var(--walnut); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.queue-trend circle { fill: var(--surface); stroke: var(--walnut); stroke-width: 2; vector-effect: non-scaling-stroke; }
.queue-trend-empty { display: grid; min-height: 6.1rem; place-items: center; color: var(--avds-data-muted); font-size: .56rem; }

/* ComparisonBarRow: language coverage from live RU and KK playlists. */
.station-language-compare { margin-top: .65rem; }
.comparison-bar-list { display: grid; gap: .72rem; margin-top: .8rem; }
.comparison-bar-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 7rem; align-items: center; gap: .7rem; }
.comparison-bar-row > span { font-family: Georgia, "Times New Roman", serif; font-size: .86rem; }
.comparison-bar-track { height: .72rem; overflow: hidden; background: #d8e3dd; }
.comparison-bar-track i { width: 0; display: block; height: 100%; min-width: 2px; background: var(--walnut); }
.comparison-bar-row:nth-child(2) .comparison-bar-track i { background: var(--brass); }
.comparison-bar-row strong { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .53rem; font-weight: 650; }
.comparison-bar-row small { display: block; color: var(--avds-data-muted); font-size: .46rem; font-weight: 400; }
.avds-method-note { margin: .7rem 0 0; color: var(--avds-data-muted); font-size: .5rem; }

/* EvidenceTrail: compact public lineage from source to prepared voice. */
.qa-evidence-trail {
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px solid var(--avds-data-line);
}
.qa-evidence-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
  margin: .7rem 0 0;
  padding: 0;
  list-style: none;
}
.qa-evidence-list li {
  position: relative;
  min-height: 6rem;
  display: flex;
  flex-direction: column;
  padding: .65rem;
  border: 1px solid var(--avds-data-line);
  background: rgba(255, 252, 245, .46);
}
.qa-evidence-list li + li::before {
  content: "→";
  position: absolute;
  top: 1.1rem;
  left: -.65rem;
  color: var(--avds-data-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .7rem;
}
.qa-evidence-list span,
.qa-evidence-list em {
  color: var(--avds-data-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .42rem;
  font-style: normal;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.qa-evidence-list strong {
  margin-top: .8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .9rem;
  font-weight: 400;
}
.qa-evidence-list small {
  margin-top: .25rem;
  color: var(--avds-data-muted);
  font-size: .48rem;
  line-height: 1.35;
}
.qa-evidence-list em { margin-top: auto; color: var(--avds-data-accent); }
.qa-evidence-list li.is-ready { border-color: rgba(90, 122, 97, .55); background: rgba(217, 229, 214, .68); }
.qa-evidence-list li.is-ready em { color: #4f7658; }

/* TreemapStrip: operator working set, weighted by estimated audio duration. */
.operator-queue-profile { margin-top: .9rem; padding: .75rem; border: 1px solid var(--avds-data-line); background: #ebe5da; }
.operator-queue-tape { min-height: 4.6rem; display: flex; align-items: stretch; gap: 2px; margin-top: .7rem; overflow: hidden; background: #d8d0c2; }
.operator-queue-tape > span { min-width: 3px; display: flex; align-items: flex-end; padding: .3rem; background: #75513a; }
.operator-queue-tape > span:nth-child(3n+2) { background: #a98445; }
.operator-queue-tape > span:nth-child(3n+3) { background: #8a8174; }
.operator-queue-tape > span b { color: rgba(255,255,255,.82); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .39rem; }
.operator-queue-tape > span.is-empty { width: 100%; background: #d8d0c2; }
.operator-queue-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: .55rem 0 0; border-top: 1px solid var(--avds-data-line); }
.operator-queue-metrics div { min-width: 0; padding: .55rem .25rem 0; }
.operator-queue-metrics dt { color: var(--avds-data-muted); font-size: .43rem; text-transform: uppercase; }
.operator-queue-metrics dd { margin: .25rem 0 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .57rem; font-weight: 700; }

/* PipelineFlow and ContractStatus: state comes from /api/ready plus the live queue. */
.engine-flow article > small {
  display: block;
  margin-top: 1rem;
  color: #81796c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .45rem;
  letter-spacing: .1em;
}
.engine-flow article.is-ready { background: #302e29; }
.engine-flow article.is-ready > small { color: var(--brass-light); }
.engine-flow article.is-error { box-shadow: inset 0 -2px #9d3829; }
.engine-flow article.is-error > small { color: #d06758; }
.engine-flow article.is-stale { background: #403a30; box-shadow: inset 0 -2px var(--brass); }
.engine-flow article.is-stale > small { color: var(--brass-light); }
.console-row.is-error > i { background: #9d3829; border-color: #9d3829; }
.console-row.is-error > em { color: #d06758; }
.console-row.is-stale > i { background: var(--brass); border-color: var(--brass); }
.console-row.is-stale > em { color: var(--brass-light); }

/* RangeBar: full-day schedule without pretending every slot has the same duration. */
.schedule-range { display: grid; gap: .35rem; margin-top: .9rem; }
.schedule-scale { display: grid; grid-template-columns: repeat(5, 1fr); padding-left: 14rem; color: var(--avds-data-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .43rem; }
.schedule-scale span:not(:first-child) { text-align: right; }
.schedule-range article {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: .65rem 0;
  border-top: 1px solid var(--avds-data-line);
}
.schedule-range article:last-child { border-bottom: 1px solid var(--avds-data-line); }
.schedule-range-copy { min-width: 0; }
.schedule-range-copy time { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .48rem; }
.schedule-range-copy h3 { margin: .22rem 0 .08rem; font-family: Georgia, "Times New Roman", serif; font-size: .92rem; font-weight: 400; line-height: 1.05; }
.schedule-range-copy p { margin: 0; overflow: hidden; color: var(--avds-data-muted); font-size: .52rem; text-overflow: ellipsis; white-space: nowrap; }
.schedule-range-track { position: relative; height: 1.35rem; overflow: hidden; background: #ddd5c7; }
.schedule-range-track i { position: absolute; top: 0; bottom: 0; background: var(--walnut); }
.schedule-range article:nth-child(3n+2) .schedule-range-track i { background: #9d382e; }
.schedule-range article:nth-child(3n+3) .schedule-range-track i { background: var(--brass); }
.schedule-range-track::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgba(27,26,24,.13) calc(25% - 1px) 25%); pointer-events: none; }

/* DataQualityScorecard and EvidenceTrail for the protected operator desk. */
.operator-quality-compare,
.operator-evidence-panel,
.approval-rhythm-panel {
  margin-top: .8rem;
  padding: 1rem;
  border: 1px solid #454139;
  background: #1e1d1a;
  color: #eee8dc;
}
.operator-quality-compare [data-avds-primitive],
.operator-evidence-panel [data-avds-primitive] { --avds-data-line: rgba(255,255,255,.14); --avds-data-muted: #918a7e; }
.operator-quality-compare .avds-data-head,
.operator-evidence-panel .avds-data-head,
.approval-rhythm-panel .avds-data-head { border-color: rgba(255,255,255,.14); }
.operator-quality-compare .avds-data-head h3,
.operator-evidence-panel .avds-data-head h3,
.approval-rhythm-panel .avds-data-head h3 { color: #eee8dc; }
.operator-quality-compare .comparison-bar-track { background: #3d3933; }
.operator-quality-compare .comparison-bar-row:first-child .comparison-bar-track i { background: #777064; }
.operator-quality-compare .comparison-bar-row:nth-child(2) .comparison-bar-track i { background: var(--brass-light); }
.operator-quality-compare .comparison-bar-row > span { color: #d8cfc2; }
.operator-quality-compare .comparison-bar-row strong { color: #eee8dc; }

.operator-evidence-trail { display: grid; grid-template-columns: repeat(4, 1fr); margin: .85rem 0 0; padding: 0; list-style: none; counter-reset: evidence; }
.operator-evidence-trail li { position: relative; min-height: 7.5rem; padding: .8rem; border: 1px solid #454139; counter-increment: evidence; }
.operator-evidence-trail li + li { border-left: 0; }
.operator-evidence-trail li::before { content: "0" counter(evidence); color: var(--brass-light); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .45rem; }
.operator-evidence-trail li::after { content: ""; position: absolute; top: 1rem; right: -.22rem; z-index: 2; width: .42rem; height: .42rem; border: 1px solid #6d665b; border-radius: 50%; background: #1e1d1a; }
.operator-evidence-trail li:last-child::after { display: none; }
.operator-evidence-trail strong { display: block; margin-top: 1.6rem; font-family: Georgia, "Times New Roman", serif; font-size: .9rem; font-weight: 400; }
.operator-evidence-trail small { display: block; margin-top: .3rem; color: #837c70; font-size: .48rem; }
.operator-evidence-trail li.is-ready { background: #2d2b26; }
.operator-evidence-trail li.is-ready strong { color: var(--brass-light); }

.approval-rhythm-panel .queue-rhythm-day { border-color: #454139; background: #2b2925; color: #bcb4a8; }
.approval-rhythm-panel .queue-rhythm-day[data-level="1"] { background: #433b2f; }
.approval-rhythm-panel .queue-rhythm-day[data-level="2"] { background: #665136; }
.approval-rhythm-panel .queue-rhythm-day[data-level="3"],
.approval-rhythm-panel .queue-rhythm-day[data-level="4"] { background: #a98445; color: #161513; }

@media (max-width: 900px) {
  .comparison-bar-row { grid-template-columns: 6.5rem minmax(0, 1fr) 6rem; }
  .operator-evidence-trail { grid-template-columns: 1fr 1fr; }
  .operator-evidence-trail li + li { border-left: 1px solid #454139; }
  .operator-evidence-trail li:nth-child(even) { border-left: 0; }
  .operator-evidence-trail li:nth-child(n+3) { border-top: 0; }
  .operator-evidence-trail li::after { display: none; }
}

@media (max-width: 640px) {
  .data-state-banner { grid-template-columns: auto minmax(0, 1fr); }
  .data-state-banner .text-button { grid-column: 2; justify-self: start; }
  .avds-data-head { align-items: flex-start; flex-direction: column; }
  .avds-data-head > small { text-align: left; }
  .queue-pulse-bars { min-height: 6rem; }
  .queue-rhythm-grid { grid-template-columns: repeat(7, minmax(2.2rem, 1fr)); overflow-x: auto; }
  .queue-rhythm-day { min-height: 3.4rem; padding: .3rem; }
  .queue-rhythm-day small { display: none; }
  .comparison-bar-row { grid-template-columns: 4.7rem minmax(0, 1fr); gap: .45rem; }
  .comparison-bar-row strong { grid-column: 1 / -1; text-align: left; }
  .schedule-scale { display: none; }
  .schedule-range article { grid-template-columns: 1fr; gap: .5rem; padding: .8rem 0; }
  .schedule-range-copy p { white-space: normal; }
  .schedule-range-track { height: .85rem; }
  .operator-evidence-trail { grid-template-columns: 1fr; }
  .operator-evidence-trail li + li,
  .operator-evidence-trail li:nth-child(even),
  .operator-evidence-trail li:nth-child(n+3) { border-top: 0; border-left: 1px solid #454139; }
  .qa-evidence-list { grid-template-columns: 1fr; }
  .qa-evidence-list li + li::before { content: "↓"; top: -.65rem; left: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .queue-pulse-bars > span,
  .voice-visual span { transition: none; }
}
