/* ============================================================
   VIDARIA 1.1 DASHBOARD
   ------------------------------------------------------------
   Phase 4: outer chrome restyle for the existing Dashboard
   component (in-place swap pattern, same as ReportCard / Home).
   Existing chart subcomponents (IncidentReportGraph,
   TourCompletionGraph, etc.) reused verbatim inside new
   OpsCard chrome.

   Naming: .vds-dash-* — never collides with .dashboard or
   .dash-graph-container legacy selectors.
   ============================================================ */

.vds-dash {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  /* min-width:0 so the inner grids (which use minmax(0,1fr) tracks) can
     shrink within the flex column instead of overflowing the viewport. */
  min-width: 0;
  box-sizing: border-box;
}

/* ── Toolbar (period selector + compare toggle + officer focus) ── */
.vds-dash-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}
.vds-dash-toolbar-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  margin-right: 4px;
}
.vds-dash-toolbar-spacer { flex: 1; }
.vds-dash-toolbar-status {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
  font-weight: var(--font-weight-semibold);
}

/* Compare-mode callout — sits inline in the toolbar when on */
.vds-dash-compare-callout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--vidaria-blue-tint);
  color: var(--vidaria-blue);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}
.vds-dash-compare-callout-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vidaria-blue);
}

/* Custom date input row (shown only when period = 'custom') */
.vds-dash-custom-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vds-dash-date-input {
  height: 32px;
  padding: 0 8px;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--white);
  color: var(--gray-900);
}
.vds-dash-date-input:focus {
  border-color: var(--vidaria-blue);
  box-shadow: 0 0 0 3px var(--vidaria-blue-tint);
}

/* Officer-focus dropdown */
.vds-dash-focus-select {
  height: 32px;
  padding: 0 8px;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-900);
  cursor: pointer;
  min-width: 180px;
}
.vds-dash-focus-select:focus { border-color: var(--vidaria-blue); outline: none; }

/* ── KPI tile grid (mockup: separate cards, colored top-borders) ── */
.vds-dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 1100px) {
  .vds-dash-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .vds-dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.vds-dash-kpi {
  background: var(--white);
  border: var(--border);
  border-top: 3px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: box-shadow var(--transition-fast);
}
.vds-dash-kpi:hover { box-shadow: var(--shadow-md); }
.vds-dash-kpi-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vds-dash-kpi-value {
  font-size: 26px;
  font-weight: 900;
  color: var(--gray-900);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ── Page header (title + subtitle) ── */
.vds-dash-page-head { padding: 2px 2px 0; }
.vds-dash-page-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--gray-900);
}
.vds-dash-page-sub {
  font-size: var(--font-size-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

/* ── LIVE strip ── */
.vds-dash-live-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 7px 14px;
  background: var(--gray-50);
  border: var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.vds-dash-live-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  white-space: nowrap;
  flex-shrink: 0;
}
.vds-dash-live-item:first-child { padding-left: 4px; }
.vds-dash-live-sep {
  width: 1px;
  height: 16px;
  background: var(--gray-200);
  flex-shrink: 0;
}
.vds-dash-live-spacer { flex: 1; }
.vds-dash-live-val { font-size: var(--font-size-sm); font-weight: 800; }
.vds-dash-live-text { font-size: var(--font-size-sm); color: var(--gray-600); }
.vds-dash-live-muted { color: var(--gray-400); }
.vds-dash-live-soon {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
  background: var(--gray-150);
  border-radius: var(--radius-full);
  padding: 1px 6px;
}
.vds-dash-live-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #10b981;
  background: #dcfce7;
  border-radius: 4px;
  padding: 2px 5px;
}
.vds-dash-live-pulse {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
  animation: vds-dash-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes vds-dash-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.vds-dash-kpi-delta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

/* ── Chart grid (3×3 essential) ── */
.vds-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (max-width: 1100px) {
  .vds-dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .vds-dash-grid { grid-template-columns: 1fr; }
}

.vds-dash-chart-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vds-dash-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-light);
  flex-shrink: 0;
}
.vds-dash-chart-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--gray-900);
}
.vds-dash-chart-meta {
  font-size: var(--font-size-xs);
  color: var(--gray-400);
  font-weight: var(--font-weight-semibold);
}
.vds-dash-chart-body {
  padding: var(--space-3);
  min-height: 240px;
  position: relative;
}

/* No-data handling: the reused legacy graph components render a
   placeholder chart (empty axes) PLUS a `.no-data-message`. Under the
   Vidaria shell, turn that message into a clean centered overlay that
   masks the awkward empty axes behind it. One rule covers all 14 graphs.
   The legacy `.chart-view` becomes the positioning context. */
.vds-dash-chart-body .chart-view { position: relative; height: 100%; min-height: 200px; }
.vds-dash-chart-body .no-data-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  margin: 0;
  background: var(--white);
  color: var(--gray-400);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
}
/* Some legacy components put the message OUTSIDE .chart-view (sibling of
   the canvas wrapper). Catch those too — overlay the whole body. */
.vds-dash-chart-body > .graph-container > .no-data-message,
.vds-dash-chart-body .graph-container .chart-view + .no-data-message {
  position: absolute;
  inset: 38px 0 0 0;   /* below the export toggle row */
}

/* Export CSV / Show Table toolbar — restyle the legacy buttons to match
   the new chrome (flat, subtle, right-aligned ghost buttons). The legacy
   `.export-toggle-container` renders a bright-blue link + dark pill;
   override both under the shell to quiet, consistent chips. */
.vds-dash-chart-body .export-toggle-container {
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}
.vds-dash-chart-body .export-toggle-container .btn,
.vds-dash-chart-body .export-toggle-container a.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  box-shadow: none;
}
.vds-dash-chart-body .export-toggle-container .btn:hover,
.vds-dash-chart-body .export-toggle-container a.btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}
/* Show Table / Show Graph toggle gets a faint accent to read as primary */
.vds-dash-chart-body .export-toggle-container .btn-change {
  border-color: var(--vidaria-blue-light, var(--gray-300));
  color: var(--vidaria-blue);
  background: var(--vidaria-blue-tint);
}
.vds-dash-chart-body .export-toggle-container .btn-change:hover {
  background: var(--vidaria-blue-pale, var(--gray-100));
  color: var(--vidaria-blue);
}
/* Neutralize legacy graph-container styles when they appear inside */
.vds-dash-chart-body .dash-graph-container,
.vds-dash-chart-body .graph-title {
  padding: 0;
  margin: 0;
  box-shadow: none;
  border: none;
  background: transparent;
}
.vds-dash-chart-body .graph-title { display: none; }   /* outer header owns the title now */

/* ── Advanced drawer ── */
.vds-dash-advanced {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.vds-dash-advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--gray-700);
  transition: background var(--transition-fast);
}
.vds-dash-advanced-toggle:hover { background: var(--gray-100); }
.vds-dash-advanced-body {
  padding: var(--space-4);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  border-top: var(--border-light);
}
@media (max-width: 1100px) {
  .vds-dash-advanced-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .vds-dash-advanced-body { grid-template-columns: 1fr; }
}

/* ── Scheduling track: above-the-scheduler coverage chip bar ── */
.vds-sched-chrome {
  margin: var(--space-3) var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.vds-sched-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.vds-sched-header-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--gray-900);
}
.vds-sched-header-meta {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

/* ════════════════════════════════════════════════════════════
   VIDARIA 1.1 DASHBOARD — Wave A sections (mockup full match)
   Sections: Performance Insights, Operations Watch, Operations
   Analytics. Scoped under body.vds-shell via the parent surface.
   ════════════════════════════════════════════════════════════ */

/* ── Section wrapper + header ── */
.vds-dash-section { display: flex; flex-direction: column; gap: var(--space-3); }
.vds-dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vds-dash-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: var(--gray-900);
}
.vds-dash-section-meta {
  font-size: var(--font-size-xs);
  color: var(--gray-400);
  font-weight: var(--font-weight-semibold);
}

/* Shared empty / scaffold states */
.vds-dash-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 16px;
  font-size: var(--font-size-xs);
  color: var(--gray-400);
}
.vds-dash-empty--ok { color: var(--gray-500); }
.vds-dash-scaffold {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  text-align: center;
  padding: 18px 16px;
  font-size: var(--font-size-xs);
  color: var(--gray-500);
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-md);
}
.vds-dash-scaffold--tall {
  flex-direction: column;
  gap: 6px;
  min-height: 160px;
  justify-content: center;
}
.vds-dash-scaffold-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--gray-600);
}
.vds-dash-scaffold-sub {
  font-size: var(--font-size-xs);
  color: var(--gray-400);
  max-width: 320px;
}

/* ── Performance Insights ── */
.vds-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) { .vds-insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .vds-insights-grid { grid-template-columns: 1fr; } }
.vds-insight-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;          /* allow the card to shrink inside its grid track */
  box-sizing: border-box;
  overflow: hidden;      /* never let inner content bleed past the card edge */
}
.vds-insight-card--warn { border-color: #ffc9c5; background: #fff8f7; }
.vds-insight-card--soon { background: var(--gray-50); }
.vds-insight-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.vds-insight-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.vds-insight-headings { flex: 1; min-width: 0; }
.vds-insight-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
}
.vds-insight-name {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: var(--gray-900);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vds-insight-value {
  font-size: var(--font-size-xl);
  font-weight: 900;
  margin-left: auto;
  flex-shrink: 0;
}
.vds-insight-bar-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vds-insight-bar {
  flex: 1 1 0;
  min-width: 0;
  height: 6px;
  border-radius: var(--radius-full);
  position: relative;
  overflow: visible;
}
.vds-insight-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: var(--radius-full);
}
.vds-insight-avg-marker {
  position: absolute;
  top: -3px;
  width: 2px; height: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: 1px;
  transform: translateX(-50%);
}
.vds-insight-avg-label {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  flex-shrink: 0;
}
.vds-insight-soon-note {
  font-size: 11px;
  color: var(--gray-400);
  font-style: italic;
}

/* ── Operations Watch ── */
.vds-opswatch-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  /* The Site Coverage Grid (right) drives the row height; the Missed
     Checkpoints card (left) stretches to match and scrolls internally.
     `align-items: stretch` + the missed card NOT contributing its content
     height to the row (see --missed below) makes coverage the source. */
  align-items: stretch;
}
@media (max-width: 1100px) { .vds-opswatch-grid { grid-template-columns: 1fr; } }
.vds-opswatch-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.vds-opswatch-card--warn { border-color: #ffc9c5; background: #fff8f7; }

/* Missed Checkpoints: collapses to the Site Coverage Grid's height.
   - The card is a flex column whose row list scrolls.
   - `min-height: 0` + `overflow: hidden` stop its (potentially long) row
     list from inflating the grid row, so the coverage card alone defines
     the height; stretch then sizes this card to match and the rows scroll.
   - On narrow screens (single column) the grid no longer constrains it, so
     a max-height keeps the list from running away. */
.vds-opswatch-card--missed {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .vds-opswatch-card--missed { max-height: 360px; }
}
.vds-missed-scroll {
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
  margin: 0 -4px;   /* let scrollbar sit at the card edge */
  padding: 0 4px;
}
.vds-missed-scroll::-webkit-scrollbar { width: 6px; }
.vds-missed-scroll::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
.vds-missed-row:first-child { border-top: none; }
.vds-opswatch-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}
.vds-opswatch-head--spread { justify-content: space-between; }
.vds-opswatch-title-row { display: flex; align-items: center; gap: 7px; }
.vds-opswatch-title { font-size: var(--font-size-xs); font-weight: 800; }
.vds-opswatch-title--dark { color: var(--gray-900); }
.vds-opswatch-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  margin-left: 2px;
}

/* Missed checkpoints rows */
.vds-missed-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--gray-100);
}
.vds-missed-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  margin-top: 4px;
}
.vds-missed-body { flex: 1; min-width: 0; }
.vds-missed-tag { font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); color: var(--gray-900); }
.vds-missed-loc {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vds-missed-when { font-size: 10px; font-weight: var(--font-weight-semibold); color: #ef4444; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }

/* Coverage grid */
.vds-cov-legend { display: flex; gap: 10px; }
.vds-cov-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--gray-500);
  white-space: nowrap;
}
.vds-cov-legend-dot { width: 12px; height: 12px; border-radius: 3px; border: 1px solid transparent; flex-shrink: 0; }
.vds-cov-table-wrap { overflow-x: auto; }
.vds-cov-table { width: 100%; border-collapse: collapse; }
.vds-cov-site-th {
  padding: 6px 10px 6px 0;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  text-align: left;
  white-space: nowrap;
  min-width: 130px;
}
.vds-cov-th {
  padding: 6px 4px;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  text-align: center;
}
.vds-cov-site { font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); color: var(--gray-700); padding: 4px 10px 4px 0; white-space: nowrap; }
.vds-cov-td { padding: 4px; text-align: center; }
.vds-cov-cell {
  display: block;
  width: 28px; height: 22px;
  border-radius: 4px;
  border: 1px solid transparent;
  margin: 0 auto;
  transition: opacity var(--transition-fast);
}
.vds-cov-cell:hover { opacity: 0.75; }

/* ── Operations Analytics — wide chart ── */
.vds-dash-chart-wide { grid-column: span 3; }
@media (max-width: 1100px) { .vds-dash-chart-wide { grid-column: span 2; } }
@media (max-width: 640px)  { .vds-dash-chart-wide { grid-column: span 1; } }

/* ── Incident Severity breakdown ── */
.vds-sev-wrap { display: flex; flex-direction: column; gap: 14px; }
.vds-sev-bars { display: flex; flex-direction: column; gap: 8px; }
.vds-sev-row { display: flex; align-items: center; gap: 10px; }
.vds-sev-label { width: 70px; font-size: 11px; font-weight: var(--font-weight-bold); flex-shrink: 0; }
.vds-sev-track {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.vds-sev-fill { display: block; height: 100%; border-radius: var(--radius-full); }
.vds-sev-count { width: 20px; text-align: right; font-size: var(--font-size-xs); font-weight: 800; flex-shrink: 0; }
.vds-sev-donut { height: 150px; position: relative; }

/* ════════════════════════════════════════════════════════════
   VIDARIA 1.1 — Compare Groups (compact A/B metrics diff)
   ════════════════════════════════════════════════════════════ */
.vds-cmp {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  /* Flex item AND flex column container — min-width:0 on both so the
     nowrap metrics table can't blow the layout wider than the viewport. */
  min-width: 0;
  box-sizing: border-box;
}
.vds-cmp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vds-cmp-pickers {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-3) var(--space-4);
}
.vds-cmp-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vds-cmp-picker-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}
.vds-cmp-picker--fixed .vds-cmp-picker-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--vidaria-blue);
  background: var(--vidaria-blue-tint);
  border-radius: var(--radius-md);
  padding: 5px 12px;
}
.vds-cmp-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border: none;
  background: var(--gray-100);
  color: var(--gray-500);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.vds-cmp-remove:hover { background: var(--gray-200); color: var(--gray-700); }
.vds-cmp-add { white-space: nowrap; }

/* Metrics table */
.vds-cmp-table-wrap {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  /* Cap to the parent so the inner scroll engages instead of expanding it. */
  max-width: 100%;
  min-width: 0;
}
.vds-cmp-table { width: 100%; border-collapse: collapse; }
.vds-cmp-table thead th {
  position: sticky;
  top: 0;
  background: var(--gray-50);
  border-bottom: var(--border);
}
.vds-cmp-metric-th,
.vds-cmp-col-th,
.vds-cmp-delta-th {
  text-align: left;
  padding: 10px 16px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  white-space: nowrap;
}
.vds-cmp-col-th { text-align: right; }
.vds-cmp-delta-th { text-align: right; }
.vds-cmp-table tbody tr { border-bottom: 1px solid var(--gray-100); }
.vds-cmp-table tbody tr:last-child { border-bottom: none; }
.vds-cmp-table tbody tr:hover { background: var(--gray-50); }
.vds-cmp-metric {
  padding: 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--gray-700);
  white-space: nowrap;
}
.vds-cmp-val {
  padding: 10px 16px;
  text-align: right;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
}
.vds-cmp-delta { padding: 10px 16px; text-align: right; }
.vds-cmp-delta-badge {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}
.vds-cmp-delta-badge.is-up   { color: var(--success); background: rgba(16,185,129,0.12); }
.vds-cmp-delta-badge.is-down { color: var(--danger);  background: rgba(239,68,68,0.12); }
.vds-cmp-delta-badge.is-flat { color: var(--gray-500); background: var(--gray-100); }

/* Compare-vs-previous block (under the toolbar when Compare is on) */
.vds-cmp-prev { display: flex; flex-direction: column; gap: var(--space-2); }
.vds-cmp-prev-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}
