/* landing/yar-dashboard.css
   Styles for yar/dashboard.html, the Yar v11 features / waves / votes
   dashboard. Builds on the warm-paper page tokens already defined in
   landing/styles.css (--bg, --bg-soft, --ink, --muted, --hair, --violet,
   --azure, --indigo, --teal, --coral) plus the dark-panel tokens in
   landing/viz-panels.css / landing/viz-tokens.generated.css so the
   chart panels read consistently with the platform page's figures. */

.yd-section { padding-top: 4px; }

.yd-intro { max-width: 68ch; }

/* ── Fallback / status banners ────────────────────────────── */
.yd-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  margin: 18px 0;
}
.yd-banner strong { font-weight: 650; }
.yd-banner.is-warn {
  background: #fff6ec;
  border: 1px solid rgba(226, 141, 33, 0.35);
  color: #6b4b12;
}
.yd-banner.is-info {
  background: var(--yar-azure-bg, #eef4ff);
  border: 1px solid rgba(59, 125, 214, 0.3);
  color: #1f3f68;
}
.yd-banner[hidden] { display: none; }

/* ── KPI strip ─────────────────────────────────────────────── */
.yd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}
.yd-kpi-card {
  background: var(--surface, #fff);
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: left;
}
.yd-kpi-value {
  display: block;
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 1.3rem + 0.6vw, 2rem);
  font-weight: 650;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.yd-kpi-value.is-muted { color: var(--muted); font-size: 1.1rem; font-weight: 600; }
.yd-kpi-label {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.yd-kpi-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--faint);
}

@media (max-width: 980px) {
  .yd-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .yd-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .yd-kpi-card { padding: 12px 10px; }
}

/* ── Filters ───────────────────────────────────────────────── */
.yd-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 24px 0 10px;
}
.yd-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}
.yd-filter-field.is-search { flex: 1 1 220px; }
.yd-filter-field label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.yd-filter-field select,
.yd-filter-field input[type="search"] {
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--hair);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
}
.yd-variant-toggle {
  display: flex;
  gap: 6px;
}
.yd-variant-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  min-height: 44px;
  border: 1px solid var(--hair);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.yd-variant-btn[aria-pressed="true"] {
  background: var(--yar-violet, #6E5BD1);
  border-color: var(--yar-violet, #6E5BD1);
  color: #fff;
}
.yd-filter-reset {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--yar-azure, #3B7DD6);
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 4px;
  text-decoration: underline;
}
.yd-filter-status {
  width: 100%;
  font-size: 12.5px;
  color: var(--muted);
}

/* ── Charts ────────────────────────────────────────────────── */
.yd-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 22px 0;
}
.yd-chart-panel {
  background: var(--cg-neutral-900, #1E1E32);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-lg, 0 12px 30px rgba(0,0,0,0.18));
  display: flex;
  flex-direction: column;
}
.yd-chart-panel.is-wide { grid-column: 1 / -1; }
.yd-chart-title {
  font-family: var(--tpl-code, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cg-day-300, #C4C4D8);
  margin: 0 0 4px;
}
.yd-chart-caption {
  font-size: 12.5px;
  color: var(--on-night-2, #ADAAC8);
  margin: 0 0 14px;
  max-width: 52ch;
}
.yd-chart-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.yd-chart-toggle button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: var(--on-night-2, #ADAAC8);
  cursor: pointer;
}
.yd-chart-toggle button[aria-pressed="true"] {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.yd-chart-canvas-wrap { position: relative; height: 260px; }
.yd-chart-panel.is-wide .yd-chart-canvas-wrap { height: 320px; }
.yd-chart-canvas-wrap canvas { max-width: 100%; }
.yd-empty-chart {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--on-night-2, #ADAAC8);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 0 20px;
}
.yd-chart-panel.is-wide .yd-empty-chart { height: 320px; }

@media (max-width: 860px) {
  .yd-charts-grid { grid-template-columns: 1fr; }
}

/* ── Table ─────────────────────────────────────────────────── */
.yd-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hair);
  border-radius: 14px;
  margin: 22px 0 12px;
}
.yd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 780px;
}
.yd-table caption { text-align: left; padding: 12px 14px 0; color: var(--muted); font-size: 12.5px; }
.yd-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-section);
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}
.yd-table th button {
  font: inherit;
  font-weight: 650;
  font-size: 12px;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.yd-table th button:hover { color: var(--yar-violet, #6E5BD1); }
.yd-sort-arrow { font-size: 10px; opacity: 0.55; }
.yd-table th[aria-sort="ascending"] .yd-sort-arrow,
.yd-table th[aria-sort="descending"] .yd-sort-arrow { opacity: 1; color: var(--yar-violet, #6E5BD1); }
.yd-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hair-soft);
  color: var(--ink-2);
  vertical-align: top;
}
.yd-table tbody tr:hover { background: var(--bg-soft); }
.yd-table td.num { font-variant-numeric: tabular-nums; text-align: right; }
.yd-table td.dash { color: var(--faint); }
.yd-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.yd-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.yd-band-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-section);
  color: var(--muted);
  white-space: nowrap;
}
.yd-table-empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--muted);
}
.yd-table-count {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

@media (max-width: 560px) {
  .yd-table { font-size: 12.5px; }
}
