/* revenue add-on (see ADDONS.md): placements, invoices, reports */
:root {
  --rv-booked: var(--brand, #4f46e5);
  --rv-coll: var(--ok, #059669);
  --rv-grid: var(--line, #e5e7eb);
  --rv-axis: var(--muted, #6b7280);
  --rv-soft-ok: rgba(5, 150, 105, .13);
  --rv-soft-bad: rgba(220, 38, 38, .12);
  --rv-soft-warn: rgba(217, 119, 6, .14);
  --rv-soft-brand: rgba(79, 70, 229, .12);
  --rv-soft-gray: rgba(107, 114, 128, .14);
}

.rv-gap { margin-top: 16px; }
.rv-ok { color: var(--ok, #059669); }
.rv-bad { color: var(--bad, #dc2626); }

/* sub-navigation: Reports | Placements | Invoices */
.rv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex-wrap: wrap; }
.rv-tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.rv-tabs a:hover { color: var(--ink); }
.rv-tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.rv-seg { margin-top: 12px; }

/* pills */
.pill.rv-pill, .page-head .pill.rv-pill { border: none; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.rv-st-pending-start, .page-head .pill.rv-st-pending-start { background: var(--rv-soft-warn); color: #92400e; }
.pill.rv-st-started, .page-head .pill.rv-st-started { background: var(--rv-soft-ok); color: #065f46; }
.pill.rv-st-fell-off, .page-head .pill.rv-st-fell-off { background: var(--rv-soft-bad); color: #991b1b; }
.pill.rv-st-replaced, .page-head .pill.rv-st-replaced { background: var(--rv-soft-gray); color: #4b5563; }
.pill.rv-inv-draft, .page-head .pill.rv-inv-draft { background: var(--rv-soft-gray); color: #4b5563; }
.pill.rv-inv-sent, .page-head .pill.rv-inv-sent { background: var(--rv-soft-brand); color: #3730a3; }
.pill.rv-inv-paid, .page-head .pill.rv-inv-paid { background: var(--rv-soft-ok); color: #065f46; }
.pill.rv-inv-void, .page-head .pill.rv-inv-void { background: var(--rv-soft-gray); color: #6b7280; text-decoration: line-through; }
.pill.rv-inv-overdue, .page-head .pill.rv-inv-overdue { background: var(--bad, #dc2626); color: #fff; }
.pill.rv-needs { background: var(--rv-soft-warn); color: #92400e; font-weight: 500; }
.pill.rv-guar { background: var(--rv-soft-brand); color: #3730a3; font-weight: 500; }

/* tables */
.rv-table td.num, .rv-table th.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-click { cursor: pointer; }
.rv-click:hover td { background: var(--rv-soft-brand); }
tr.rv-overdue td { background: var(--rv-soft-bad); }
tr.rv-overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad, #dc2626); }
tr.rv-sum td { border-top: 2px solid var(--line); }
.rv-mini { width: auto; min-width: 220px; margin: 8px 0; }
.rv-mini td, .rv-mini th { padding: 4px 10px; }
.rv-csv { margin-left: auto; font-size: 12px; padding: 3px 9px; text-decoration: none !important; }
.card-head .rv-csv { margin-left: 8px; }
.rv-warn { background: var(--rv-soft-warn); border-color: transparent; margin-bottom: 12px; padding: 12px 16px; }

/* placement modal */
.rv-who { background: var(--rv-soft-brand); border-radius: 8px; padding: 10px 12px; margin: 8px 0 4px; }
.rv-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) 96px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.rv-pct { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.rv-pct input { width: 72px; }
.rv-split-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 13px; }
.rv-gend { margin-top: 6px; }
.rv-line { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 8px; margin-bottom: 6px; }
@media (max-width: 560px) {
  .rv-split { grid-template-columns: 1fr 1fr; }
  .rv-line { grid-template-columns: 1fr 100px auto; }
}

/* reports */
.rv-filters .rv-inl { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.rv-filters .rv-inl select, .rv-filters .rv-inl input { width: auto; }
.rv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.rv-tile { display: block; color: inherit; text-decoration: none !important; padding: 14px 16px; transition: border-color .1s, transform .1s; }
a.rv-tile:hover { border-color: var(--brand); transform: translateY(-1px); }
.rv-tile .n { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rv-tile .l { color: var(--muted); font-size: 13px; font-weight: 600; }
.rv-tile .sub { font-size: 12px; margin-top: 2px; }
.rv-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .rv-two { grid-template-columns: 1fr; } }

.rv-chart { width: 100%; height: auto; display: block; max-height: 320px; }
.rv-chart .rv-grid { stroke: var(--rv-grid); stroke-width: 1; }
.rv-chart .rv-base { stroke: var(--rv-axis); stroke-width: 1; }
.rv-chart .rv-axis { fill: var(--rv-axis); font-size: 11px; font-family: inherit; }
.rv-chart .rv-bar-booked { fill: var(--rv-booked); }
.rv-chart .rv-bar-coll { fill: var(--rv-coll); }
.rv-chart a:hover rect.rv-bar-booked, .rv-chart a:focus rect.rv-bar-booked,
.rv-chart a:hover rect.rv-bar-coll, .rv-chart a:focus rect.rv-bar-coll { opacity: .8; }
.rv-chart a:focus { outline: none; }
.rv-chart a:focus-visible rect[fill="transparent"] { stroke: var(--brand); stroke-width: 2; }
.rv-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; align-items: center; }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rv-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.rv-sw-booked { background: var(--rv-booked); }
.rv-sw-coll { background: var(--rv-coll); }
.rv-tbl { margin-top: 8px; }
.rv-tbl summary { cursor: pointer; color: var(--brand); font-size: 13px; }

.rv-fun { display: grid; grid-template-columns: 96px minmax(0, 1fr) 110px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.rv-fun-bar { background: var(--rv-soft-gray); border-radius: 6px; height: 18px; overflow: hidden; }
.rv-fun-bar span { display: block; height: 100%; background: var(--rv-booked); border-radius: 6px; }
.rv-fun-n { text-align: right; font-variant-numeric: tabular-nums; }
.rv-speed { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rv-speed .n { font-size: 20px; font-weight: 800; }
.rv-speed .l { font-size: 13px; font-weight: 600; color: var(--muted); }

/* home widget */
.rv-home .rv-big { display: block; color: inherit; text-decoration: none !important; margin: 4px 0 10px; }
.rv-home .rv-big .n { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rv-home-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rv-home-row a { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none !important; }
.rv-home-row a:hover { border-color: var(--brand); }
.rv-home-row b { font-size: 20px; }
.rv-home-row span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.rv-home-row a.rv-alert { border-color: var(--bad, #dc2626); background: var(--rv-soft-bad); }
.rv-home-row a.rv-alert b { color: var(--bad, #dc2626); }
.rv-nudge { display: block; margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--rv-soft-warn); color: inherit; font-size: 14px; }

/* invoice "paper" */
.rv-paper { background: #fff; color: #18181b; border: 1px solid var(--line); border-radius: 10px; padding: 40px 44px; box-shadow: var(--shadow); }
.rv-paper.rv-void { position: relative; }
.rv-paper.rv-void::after { content: "VOID"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 800; color: rgba(220, 38, 38, .12); transform: rotate(-18deg); pointer-events: none; }
@media (max-width: 640px) { .rv-paper { padding: 20px 16px; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill.rv-st-pending-start, :root:not([data-theme="light"]) .pill.rv-needs { color: #fbbf24; }
  :root:not([data-theme="light"]) .pill.rv-st-started, :root:not([data-theme="light"]) .pill.rv-inv-paid { color: #34d399; }
  :root:not([data-theme="light"]) .pill.rv-st-fell-off { color: #f87171; }
  :root:not([data-theme="light"]) .pill.rv-inv-sent, :root:not([data-theme="light"]) .pill.rv-guar { color: #a5b4fc; }
  :root:not([data-theme="light"]) .pill.rv-st-replaced, :root:not([data-theme="light"]) .pill.rv-inv-draft, :root:not([data-theme="light"]) .pill.rv-inv-void { color: #d1d5db; }
}
:root[data-theme="dark"] .pill.rv-st-started, :root[data-theme="dark"] .pill.rv-inv-paid { color: #34d399; }
:root[data-theme="dark"] .pill.rv-st-pending-start, :root[data-theme="dark"] .pill.rv-needs { color: #fbbf24; }
:root[data-theme="dark"] .pill.rv-st-fell-off { color: #f87171; }
:root[data-theme="dark"] .pill.rv-inv-sent, :root[data-theme="dark"] .pill.rv-guar { color: #a5b4fc; }

/* print: only the invoice */
@media print {
  @page { margin: 14mm; }
  body * { visibility: hidden !important; }
  .rv-paper, .rv-paper * { visibility: visible !important; }
  .rv-paper { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; padding: 0; border-radius: 0; }
  .rv-noprint { display: none !important; }
  html, body, .shell, #view, .main { background: #fff !important; overflow: visible !important; height: auto !important; }
}
