/* Revenue assurance, Agent R views: Approvals, Findings, Dashboards, Connectors and policy.
   Tables follow the house standard in app.css; nothing here overrides table cells. Kit tokens only. */

/* Rhythm: header 24px below, sections 24px apart */
.rv > * + * { margin-top: 24px; }
.rv .page-head { margin-bottom: 0; align-items: center; }
.rv-filters { gap: 12px; }
.rv-filter { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.rv-filter .select { width: auto; min-width: 0; }
.rv-search { width: 200px; }
.rv-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--primary); font-weight: 500; cursor: pointer; white-space: nowrap; }
.rv-link:hover { text-decoration: underline; }
.rv-link.back { margin-bottom: 8px; }
.rv-chip { border: 0; cursor: pointer; }
.rv-mt8 { margin-top: 8px; }
.rv-push { margin-left: auto; }
.rv-h { margin-bottom: 8px; }
.rv-big { font-size: 20px; line-height: 28px; font-weight: 600; white-space: nowrap; }
.rv-amount { align-items: flex-end; }
.rv-actions { justify-content: flex-end; flex-wrap: wrap; }
.btn.rv-danger { color: var(--destructive); }
.table td.rv-indent { padding-left: 48px; }
.rv-inline-bar { display: block; height: 4px; max-width: 96px; margin: 4px 0 0 auto; border-radius: 2px; background: var(--chart-1); }

/* KPI rows wrap into full rows as the content narrows (panels open). */
.rv-k .ra-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* Grids */
.rv-grid { display: grid; gap: 16px; }
.rv-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rv-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rv-g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.rv-conn { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.rv-span2 { grid-column: 1 / -1; }
.rv-card .card-head { margin-bottom: 16px; align-items: center; }
@media (max-width: 1240px) { .rv-g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rv-g21 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .rv-g2, .rv-g3 { grid-template-columns: minmax(0, 1fr); } }

/* Side panel content */
.rv-side { min-width: 0; }
.rv-kv { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); align-items: center; }
.rv-kv > span { padding: 8px 0; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.rv-kv > span:nth-last-child(-n+2) { border-bottom: 0; }
.rv-kv .select { width: 100%; }
.rv-list { list-style: none; margin: 0; padding: 0; }
.rv-list li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.rv-list li svg { margin-top: 2px; color: var(--muted-foreground); }

/* Chain / lifecycle steps */
.rv-chain { list-style: none; margin: 0; padding: 0; }
.rv-step { display: flex; align-items: center; gap: 12px; padding: 8px 0; position: relative; }
.rv-step + .rv-step::before { content: ""; position: absolute; left: 11px; top: -8px; height: 16px; width: 2px; background: var(--border); }
.rv-step-ic { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--muted); color: var(--muted-foreground); }
.rv-step-ic svg.lucide { width: 14px; height: 14px; }
.rv-step.done .rv-step-ic { background: var(--success-foreground); color: var(--success); }
.rv-step.cur .rv-step-ic { background: var(--muted-brand); color: var(--primary); }
.rv-step.rej .rv-step-ic { background: var(--destructive-foreground); color: var(--destructive); }
.rv-step:not(.done):not(.cur):not(.rej) { color: var(--muted-foreground); }

/* Horizontal bars: one grid, rows use display: contents so columns align across rows */
.rv-hbars { min-width: 0; display: grid; grid-template-columns: minmax(64px, max-content) minmax(32px, 1fr) max-content max-content; column-gap: 12px; row-gap: 8px; align-items: center; }
.rv-hbar { display: contents; }
.rv-hbar.click > * { cursor: pointer; }
.rv-hbar.click:hover .rv-hbar-label { color: var(--primary); }
.rv-hbar.dim > * { opacity: .4; }
.rv-hbar.active > * { font-weight: 600; }
.rv-hbar.active .rv-hbar-label { font-weight: 600; }
.rv-hbar-label { font-size: 12px; line-height: 16px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-hbar-track { height: 12px; background: var(--muted); border-radius: 2px; overflow: hidden; }
.rv-hbar-fill { display: block; height: 100%; border-radius: 2px; }
.rv-hbar-val { font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; text-align: right; }
.rv-hbar-note { font-size: 12px; line-height: 16px; color: var(--muted-foreground); white-space: nowrap; text-align: right; }

/* Column chart: legend top left, y axis left (right aligned), x labels under each column */
.rv-colchart { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 8px; }
.rv-legend { grid-column: 1 / -1; display: flex; gap: 16px; font-size: 12px; line-height: 16px; color: var(--muted-foreground); margin-bottom: 12px; }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rv-legend i { width: 8px; height: 8px; border-radius: 2px; }
.rv-axis { display: flex; flex-direction: column; justify-content: space-between; height: 192px; font-size: 12px; line-height: 16px; color: var(--muted-foreground); text-align: right; margin: -8px 0; }
.rv-plot { display: flex; align-items: flex-end; gap: 12px; height: 192px; padding: 0 8px; border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px); background-size: 100% 50%; }
.rv-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.rv-col.dim { opacity: .4; }
.rv-col-bar { width: 40%; max-width: 24px; border-radius: 2px 2px 0 0; }
.rv-xaxis { grid-column: 2; display: flex; gap: 12px; padding: 4px 8px 0; }
.rv-xaxis span { flex: 1 1 0; min-width: 0; text-align: center; }

/* Connectors and policy */
.rv-logo { flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted-foreground); background: var(--muted); }
.rv-policy { list-style: none; margin: 0; padding: 0; }
.rv-policy li { display: flex; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.rv-policy li:last-child { border-bottom: 0; }
.rv-choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; }
.rv-choice:hover { background: var(--accent); }
.rv-choice[aria-checked="true"] { border-color: var(--border-brand); background: var(--background-brand); }
.rv-choice input { accent-color: var(--primary); margin-top: 3px; }
