/* v5.206 Reports & Dashboards */
.rp-view { max-width: 1500px; }
.rp-head { align-items: flex-start; }
.rp-titlewrap { min-width: 0; }
.rp-pick { font-size: 20px; font-weight: 700; color: var(--rail-bg); border: 1px solid transparent; background: transparent; padding: 2px 6px 2px 0; max-width: 100%; cursor: pointer; white-space: nowrap; }
html[data-theme="dark"] .rp-pick { color: var(--text); background: transparent; }
.rp-pick:hover { border-color: var(--border); border-radius: 8px; }
.rp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rp-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 4px 0 14px; }
.rp-filters label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text); }
.rp-fnote { font-size: 12.5px; }
.rp-print-head { display: none; }

.rp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.rp-card { margin: 0 !important; display: flex; flex-direction: column; min-width: 0; grid-column: span 2; }
.rp-card.rp-w2 { grid-column: span 4; }
.rp-card.rp-w3, .rp-grid > .rp-w3 { grid-column: span 6; }
.rp-card.rp-kpi { grid-column: span 1; }
.rp-card.rp-kpi.rp-w2 { grid-column: span 2; }
.rp-card.rp-kpi.rp-w3 { grid-column: span 3; }
.rp-chead { display: flex; align-items: center; gap: 8px; padding: 12px 14px 0; }
.rp-ctitle { font-weight: 700; font-size: 13.5px; color: var(--rail-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
html[data-theme="dark"] .rp-ctitle { color: var(--text); }
.rp-csub { font-size: 11.5px; color: var(--text-mute); padding: 2px 14px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
.rp-cbody { padding: 8px 12px 12px; flex: 1; min-height: 60px; position: relative; }
.rp-cmore { opacity: 0; transition: opacity .15s; font-size: 14px; }
.rp-card:hover .rp-cmore { opacity: 1; }
.rp-ctools { display: flex; gap: 2px; }
.rp-ctools .icon-btn { font-size: 14px; padding: 2px 6px; }
.rp-editing .rp-card { outline: 2px dashed #93A5CF; outline-offset: -2px; }
.rp-empty { color: var(--text-mute); font-size: 13px; padding: 24px 8px; text-align: center; }

/* KPI tile */
.rp-metric { cursor: pointer; padding: 2px 2px 0; }
.rp-metric-v { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.rp-metric-s { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.rp-delta { font-size: 12px; margin-top: 6px; color: var(--text-mute); }
.rp-delta.up { color: #15803D; } .rp-delta.down { color: #B42318; }
html[data-theme="dark"] .rp-delta.up { color: #4ADE80; } html[data-theme="dark"] .rp-delta.down { color: #F87171; }
.rp-delta span { color: var(--text-mute); }
.rp-goal { margin-top: 8px; }
.rp-goal-bar { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.rp-goal-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.rp-goal small { font-size: 11.5px; color: var(--text-mute); }

/* SVG charts */
.rp-svg { width: 100%; height: auto; display: block; overflow: visible; }
.rp-svg .rp-gl { stroke: var(--border); stroke-width: 1; }
.rp-svg .rp-base { stroke: #9AA3AF; stroke-width: 1; }
.rp-svg .rp-ax { fill: var(--text-mute); font-size: 11px; font-family: var(--font-display); }
.rp-svg .rp-val { fill: var(--text); font-size: 10.5px; font-family: var(--font-mono); }
.rp-svg .rp-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.rp-svg .rp-dot { stroke: var(--surface); stroke-width: 2; }
.rp-bar, [data-tip] { cursor: pointer; }
.rp-svg .rp-bar:hover, .rp-hseg:hover, .rp-donut .rp-bar:hover { opacity: .82; }
.rp-svg .rp-hit:hover { fill: rgba(127,127,127,.06); }
.rp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text); margin-top: 6px; }
.rp-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rp-legend i, .rp-donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

.rp-hbars { display: flex; flex-direction: column; gap: 6px; }
.rp-hrow { display: grid; grid-template-columns: minmax(70px, min(34%, 170px)) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.rp-hl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.rp-htrack { display: flex; gap: 2px; height: 16px; min-width: 0; }
.rp-hseg { display: block; height: 100%; min-width: 2px; }
.rp-hseg:first-child { border-radius: 4px 0 0 4px; } .rp-hseg:last-child { border-radius: 0 4px 4px 0; } .rp-hseg:only-child { border-radius: 0 4px 4px 0; }
.rp-hv { font-family: var(--font-mono); font-size: 12px; color: var(--text); text-align: right; min-width: 52px; }

.rp-donut-wrap { display: flex; gap: 14px; align-items: center; }
.rp-donut { width: 46%; max-width: 190px; flex: none; }
.rp-donut .rp-donut-v { fill: var(--text); font-size: 18px; font-weight: 700; font-family: var(--font-mono); }
.rp-donut .rp-ax { fill: var(--text-mute); font-size: 11px; }
.rp-donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.rp-donut-legend div { display: grid; grid-template-columns: 12px 1fr auto 36px; gap: 6px; align-items: center; }
.rp-donut-legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-donut-legend b { font-family: var(--font-mono); font-weight: 600; }
.rp-donut-legend small { color: var(--text-mute); text-align: right; font-family: var(--font-mono); }

.rp-funnel { display: flex; flex-direction: column; gap: 6px; }
.rp-frow { display: grid; grid-template-columns: minmax(70px, min(30%, 170px)) 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.rp-fl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-ftrack { display: flex; justify-content: center; height: 20px; }
.rp-ftrack span { display: block; height: 100%; border-radius: 4px; }
.rp-fv { font-family: var(--font-mono); font-size: 12px; text-align: right; }
.rp-fv small { color: var(--text-mute); margin-left: 4px; }

.rp-tip { position: fixed; z-index: 10050; pointer-events: none; background: #0D1117; color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 280px; box-shadow: var(--shadow-lg); display: none; }
.rp-tip-v { font-family: var(--font-mono); font-size: 15px; font-weight: 700; margin-top: 2px; }
.rp-tip-s { color: rgba(255,255,255,.72); font-size: 11.5px; margin-top: 2px; }

.rp-tscroll { overflow-x: auto; }
.rp-tbl { font-size: 12.5px; width: 100%; }
.rp-tbl th[data-sort] { cursor: pointer; white-space: nowrap; }
.rp-tbl th[data-sort]:hover { text-decoration: underline; }
.rp-tbl tr.rp-click { cursor: pointer; }
.rp-tbl tr.rp-click:hover td { background: rgba(37,125,224,.07); }
.rp-drill { max-height: 62vh; overflow: auto; }
.rp-drill-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* editor form */
.rp-form { display: flex; flex-direction: column; gap: 10px; }
.rp-frow2 { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.rp-frow2 .field { margin: 0; min-width: 150px; flex: 1 1 160px; }
.rp-frow2 .field.rp-wide { flex: 2 1 280px; }
.rp-frow2 .field select, .rp-frow2 .field input { width: 100%; }
.rp-ftitle { font-weight: 700; font-size: 12.5px; color: var(--text); margin-bottom: 6px; }
.rp-filt-list { border-top: 1px solid var(--border); padding-top: 10px; }
.rp-fline { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.rp-fline select, .rp-fline input { min-width: 130px; flex: 1; }
.rp-cols { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.rp-cols .rp-ftitle { width: 100%; }
.rp-colpick { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; white-space: nowrap; }
.rp-ce { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rp-ce-prev { margin: 0 !important; position: sticky; top: 0; }

/* report builder */
.rp-rb { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; align-items: start; }
.rp-rb-side { margin: 0 !important; padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 190px); overflow: auto; position: sticky; top: 8px; }
.rp-rb-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); padding: 10px 8px 4px; }
.rp-rb-item { text-align: left; background: none; border: 0; border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-rb-item:hover { background: rgba(127,127,127,.1); }
.rp-rb-item.on { background: #14295E; color: #fff; }
.rp-rb-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rp-rb-form { margin: 0 !important; padding: 14px; }
.rp-rb-out { margin: 0 !important; padding-bottom: 8px; }
.rp-rb-meta { font-size: 12px; white-space: nowrap; }
.rp-rb-chart { padding: 8px 14px; }
.rp-rb-chart .rp-metric-v { font-size: 40px; }

@media (max-width: 1200px) {
  .rp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rp-card, .rp-card.rp-w2 { grid-column: span 2; } .rp-card.rp-w3, .rp-grid > .rp-w3 { grid-column: span 4; }
  .rp-card.rp-kpi { grid-column: span 1; }
}
@media (max-width: 820px) {
  .rp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-card, .rp-card.rp-w2, .rp-card.rp-w3 { grid-column: span 2; } .rp-card.rp-kpi { grid-column: span 1; }
  .rp-rb { grid-template-columns: 1fr; } .rp-rb-side { position: static; max-height: 220px; }
  .rp-ce { grid-template-columns: 1fr; }
}
@media print {
  .rp-filters, .rp-actions, .rp-cmore { display: none !important; }
  .rp-print-head { display: block; margin-bottom: 10px; font-size: 13px; }
  .rp-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  .rp-card { break-inside: avoid; box-shadow: none !important; }
}

.rp-kpi .rp-ctitle { font-size: 12.5px; }
.rp-csub:empty { display: none; }
