/* The Reports workspace. A menu of reports on the left, and on the right the filters, the key figures, the charts and a full table. */

.rp-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px; align-items: start; }

/* ----- the menu of reports ----- */
/* The page scrolls inside .app-main and the top bar (84px) is sticky there, so the menu sticks just below the bar.
   The page area is shorter than the window (the 36px frame, and the zoom), so the height follows it. */
.rp-nav { position: sticky; top: 98px; align-self: start; max-height: calc(100dvh / var(--z, 1) - 36px - 98px - 20px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.rp-nav-group { padding: 14px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted); }
.rp-nav-group:first-child { padding-top: 4px; }
.rp-nav-item {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 0; border-radius: 14px;
    background: transparent; color: var(--color-text-nav); font: inherit; font-size: 14.5px; font-weight: 700; text-align: left; cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.rp-nav-item:hover { background: rgba(255, 255, 255, 0.8); }
.rp-nav-item.is-on { background: var(--color-ink); color: #FFFFFF; box-shadow: 0 8px 18px rgba(12, 61, 48, 0.22); }
.rp-nav-ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(12, 61, 48, 0.07); flex: 0 0 auto; }
.rp-nav-item.is-on .rp-nav-ico { background: rgba(255, 255, 255, 0.16); }

.rp-main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.rp-body { position: relative; display: flex; flex-direction: column; gap: 18px; }

/* ----- the heading ----- */
.rp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.rp-head h1 { letter-spacing: -0.02em; }
.rp-head p { margin-top: 5px; color: var(--color-text-muted); }
.rp-period { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 99px; background: var(--color-primary-soft); color: var(--color-primary-ink); font-size: 13px; font-weight: 700; }
.rp-compare { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 99px; background: #EEF2F0; color: var(--color-text-muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.rp-export { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----- the filters ----- */
.rp-filters { padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; }
.rp-filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-filter-label { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.rp-dates { display: flex; align-items: center; gap: 8px; }
.rp-dates .rx-select { width: 176px; }
.rp-to { color: var(--color-text-muted); font-size: 14px; font-weight: 600; }
.rp-category .rx-select { width: 220px; }
.rp-switch { display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 700; color: var(--color-text-nav); cursor: pointer; }
.rp-switch i { width: 40px; height: 23px; border-radius: 99px; background: #CFE0D8; position: relative; flex: 0 0 auto; transition: background 0.18s ease; }
.rp-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.18s ease; }
.rp-switch.is-on i { background: var(--color-primary); }
.rp-switch.is-on i::after { transform: translateX(17px); }
.rp-switch:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 99px; }

/* ----- the key figures ----- */
.rp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); overflow: hidden; padding: 0; }
.rp-kpi {
    padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
    border-right: 1px solid var(--color-border-soft); border-bottom: 1px solid var(--color-border-soft); margin: 0 -1px -1px 0;
    animation: rp-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 55ms);
}
.rp-kpi-label { font-size: 13px; font-weight: 700; color: var(--color-text-muted); }
.rp-kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.rp-kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; min-height: 26px; }
.rp-kpi-note { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.35; }
.rp-delta { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.rp-delta.up { background: var(--color-success-bg); color: var(--color-success-ink); }
.rp-delta.down { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.rp-delta.flat { background: #EEF2F0; color: var(--color-text-muted); }
.rp-spark { width: 72px; height: 26px; flex: 0 0 auto; margin-left: auto; overflow: visible; }
.rp-spark polyline { fill: none; stroke: #2E7D63; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: rp-draw 1.1s ease 0.2s forwards; vector-effect: non-scaling-stroke; }

/* ----- the charts ----- */
.rp-charts { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.rp-charts-2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.rp-charts-3 > :first-child { grid-column: 1 / -1; }
.rp-charts-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.rp-panel { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rp-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rp-panel-head h2 { font-size: 16px; }
.rp-legend { display: flex; gap: 16px; font-size: 12.5px; font-weight: 700; color: var(--color-text-muted); }
.rp-legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid #2E7D63; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.rp-legend i.prev { border-top: 2px dashed #9AB3A9; }
.rp-chart-empty, .rp-chart-note { margin: 0; font-size: 12.5px; color: var(--color-text-muted); }

.rp-svg { width: 100%; height: auto; display: block; overflow: visible; }
/* A chart marked Roomy is drawn twice. The taller copy is for narrow screens and the other one is hidden there. */
.rp-panel .rp-svg-m { display: none; }
@media (max-width: 700px) {
    .rp-panel .rp-svg-d { display: none; }
    .rp-panel .rp-svg-m { display: block; }
}
.rp-grid-line { stroke: #E3ECE7; stroke-width: 1; }
.rp-axis { fill: #6B7F76; font-size: 9.5px; font-weight: 600; font-family: inherit; }
.rp-area { animation: rp-fade 0.9s ease both; }
.rp-line { fill: none; stroke: #2E7D63; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: rp-draw 1.1s ease forwards; }
.rp-prev { fill: none; stroke: #9AB3A9; stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; animation: rp-fade 0.9s ease both; }
.rp-cross { stroke: #9AB3A9; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity 0.12s ease; }
.rp-dot { fill: #FFFFFF; stroke: #2E7D63; stroke-width: 2.5; opacity: 0; transition: opacity 0.12s ease; }
.rp-tip { opacity: 0; pointer-events: none; transition: opacity 0.12s ease; }
.rp-tip rect { fill: #0C3D30; }
.rp-tip text { font-family: inherit; fill: #FFFFFF; }
.rp-tip-title { font-size: 11.5px; font-weight: 600; opacity: 0.8; }
.rp-tip-value { font-size: 15px; font-weight: 800; }
.rp-tip-prev { font-size: 11.5px; font-weight: 600; opacity: 0.75; }
.rp-hit:hover .rp-cross, .rp-hit:hover .rp-dot, .rp-hit:hover .rp-tip { opacity: 1; }

/* columns, for short labels such as weekdays and months */
.rp-cols { display: grid; grid-template-columns: repeat(var(--c, 7), minmax(0, 1fr)); gap: 8px; align-items: end; height: 170px; }
.rp-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; min-width: 0; font-size: 11.5px; font-weight: 700; color: var(--color-text-muted); }
.rp-col em { font-style: normal; font-size: 11.5px; color: var(--color-text); font-weight: 800; height: 14px; white-space: nowrap; }
.rp-col span { display: block; width: 100%; max-width: 34px; min-height: 3px; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, #8FD8CC, #2E7D63); transform-origin: bottom; animation: rp-grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.rp-col.is-best span { background: linear-gradient(180deg, #F2B94B, #D98B1D); }
.rp-col b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* rows, for long names such as medicines */
.rp-hbars { display: flex; flex-direction: column; gap: 9px; }
.rp-hbar { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; animation: rp-rise 0.4s ease both; animation-delay: calc(var(--i, 0) * 40ms); }
.rp-hlabel { font-weight: 700; color: var(--color-text-nav); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-htrack { height: 10px; border-radius: 99px; background: #E8EFEC; overflow: hidden; }
.rp-htrack i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8FD8CC, #2E7D63); transform-origin: left; animation: rp-grow-x 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
.rp-hbar b { min-width: 54px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* a whole split into parts */
.rp-split { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #E8EFEC; }
.rp-split span { height: 100%; transform-origin: left; animation: rp-grow-x 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rp-split-list { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.rp-split-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; animation: rp-rise 0.4s ease both; animation-delay: calc(var(--i, 0) * 45ms); }
.rp-split-row i { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rp-split-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-split-row b { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.rp-split-row em { min-width: 48px; text-align: right; font-style: normal; color: var(--color-text-muted); font-weight: 600; }

.rp-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 4px; font-size: 13px; color: var(--color-text-muted); }

/* ----- the table ----- */
.rp-grid { overflow: hidden; }
.rp-grid-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.rp-grid-bar h2 { font-size: 17px; }
.rp-grid-count { margin: 3px 0 0; font-size: 13px; color: var(--color-text-muted); }
.rp-trunc { margin-left: 8px; color: var(--color-warning-ink); font-weight: 700; }
.rp-grid-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-search { position: relative; display: block; margin: 0; }
.rp-search input {
    height: 38px; width: 250px; padding: 0 14px 0 38px; border-radius: 99px; border: 1.5px solid var(--color-border);
    background: #FFFFFF; font: inherit; font-size: 14px; color: var(--color-text); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rp-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.rp-search svg { position: absolute; left: 13px; top: 11px; color: var(--color-text-muted); pointer-events: none; }
.rp-size-label { font-size: 12.5px; font-weight: 700; color: var(--color-text-muted); white-space: nowrap; }
.rp-size .pill { min-width: 44px; padding: 0 12px; min-height: 38px; }

.rp-scroll { max-height: 640px; overflow: auto; border-top: 1px solid var(--color-border-soft); }
.rp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.rp-table th {
    position: sticky; top: 0; z-index: 3; padding: 0; background: #F2F8F5; border-bottom: 1px solid var(--color-border);
    font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); text-align: left; white-space: nowrap;
}
.rp-table th.rp-num { text-align: right; }
.rp-sort { display: inline-flex; align-items: center; gap: 6px; width: 100%; padding: 12px 14px; border: 0; background: transparent; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-align: inherit; }
.rp-table th.rp-num .rp-sort { justify-content: flex-end; }
.rp-sort:hover { color: var(--color-ink); }
.rp-sort:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--color-primary); }
.rp-sort svg { flex: 0 0 auto; }
.rp-sort path { fill: #B6C7BF; transition: fill 0.15s ease; }
.rp-sort path.on { fill: var(--color-primary); }
.rp-table th.is-sorted { color: var(--color-ink); }
.rp-table td { padding: 11px 12px; border-bottom: 1px solid var(--color-border-soft); background: #FFFFFF; vertical-align: middle; }
.rp-table td.rp-num { text-align: right; white-space: nowrap; }
.rp-table td.rp-name { font-weight: 700; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rp-table tbody tr { animation: rp-row 0.35s ease both; animation-delay: calc(var(--i, 0) * 18ms); }
.rp-table tbody tr:hover td { background: #F1F8F4; }
.rp-link { color: var(--color-ink); text-decoration: none; }
.rp-link:hover { color: var(--color-primary); text-decoration: underline; }
.is-neg { color: var(--color-danger-ink); }
.rp-bar { display: inline-block; width: 38px; height: 6px; margin-right: 9px; border-radius: 99px; background: #E8EFEC; overflow: hidden; vertical-align: middle; }
.rp-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8FD8CC, #2E7D63); transform-origin: left; animation: rp-grow-x 0.7s ease both; }
.rp-totals td { position: sticky; bottom: 0; z-index: 2; background: #EAF3EE; border-top: 2px solid var(--color-ink); border-bottom: 0; font-weight: 800; color: var(--color-ink); }
.badge-muted { background: #EEF2F0; color: var(--color-text-muted); }

.rp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 16px; border-top: 1px solid var(--color-border-soft); font-size: 13.5px; color: var(--color-text-muted); }
.rp-foot b { color: var(--color-ink); }
.rp-pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rp-pager button { min-width: 36px; height: 36px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 99px; border: 1.5px solid var(--color-border); background: #FFFFFF; color: var(--color-text); font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.rp-pager button:hover:not(:disabled) { border-color: var(--color-border-input); background: var(--color-surface-alt); }
.rp-pager button.is-on { background: var(--color-ink); border-color: var(--color-ink); color: #FFFFFF; }
.rp-pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.rp-gap { padding: 0 4px; color: var(--color-text-muted); }

/* ----- loading ----- */
.rp-progress { position: absolute; top: -10px; left: 0; right: 0; height: 3px; border-radius: 99px; background: rgba(11, 127, 90, 0.12); overflow: hidden; z-index: 5; }
.rp-progress i { display: block; width: 38%; height: 100%; border-radius: 99px; background: var(--color-primary); animation: rp-slide 1s ease-in-out infinite; }
.rp-body.is-busy > :not(.rp-progress) { opacity: 0.55; pointer-events: none; transition: opacity 0.2s ease; }

.rp-sk { display: flex; flex-direction: column; gap: 18px; }
.rp-sk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); padding: 6px 4px; }
.rp-sk-kpi { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.rp-sk-charts { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.rp-sk-panel, .rp-sk-table { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.rp-sk-block { display: block; height: 170px; border-radius: 16px; background: linear-gradient(90deg, #E6EEEA 25%, #F3F8F5 50%, #E6EEEA 75%); background-size: 200% 100%; animation: rp-shimmer 1.3s linear infinite; }
.rp-sk-row { display: flex; gap: 22px; align-items: center; padding: 8px 0; border-top: 1px solid var(--color-border-soft); }
.rp-sk-line { display: block; height: 12px; border-radius: 99px; background: linear-gradient(90deg, #E6EEEA 25%, #F3F8F5 50%, #E6EEEA 75%); background-size: 200% 100%; animation: rp-shimmer 1.3s linear infinite; }
.rp-sk-line.tall { height: 22px; }
.rp-sk-line.w15 { width: 15%; } .rp-sk-line.w25 { width: 25%; } .rp-sk-line.w30 { width: 30%; } .rp-sk-line.w40 { width: 40%; }
.rp-sk-line.w50 { width: 50%; } .rp-sk-line.w70 { width: 70%; }

/* ----- motion ----- */
@keyframes rp-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rp-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rp-draw { to { stroke-dashoffset: 0; } }
@keyframes rp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rp-row { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rp-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes rp-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(380%); } }

@media (prefers-reduced-motion: reduce) {
    .rp-kpi, .rp-col span, .rp-hbar, .rp-htrack i, .rp-split span, .rp-split-row, .rp-table tbody tr, .rp-area, .rp-prev, .rp-bar i,
    .rp-sk-line, .rp-sk-block, .rp-progress i { animation: none; }
    .rp-line, .rp-spark polyline { animation: none; stroke-dashoffset: 0; }
}

/* ----- smaller screens ----- */
@media (max-width: 1180px) {
    .rp-charts-2, .rp-charts-3, .rp-sk-charts { grid-template-columns: minmax(0, 1fr); }
    .rp-charts-3 > :first-child { grid-column: auto; }
}

@media (max-width: 1000px) {
    .rp-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    /* The menu becomes a row you can swipe sideways. */
    .rp-nav { position: static; max-height: none; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px; gap: 6px; scrollbar-width: none; }
    .rp-nav::-webkit-scrollbar { display: none; }
    .rp-nav-group { display: none; }
    .rp-nav-item { flex: 0 0 auto; white-space: nowrap; padding: 8px 14px 8px 8px; }
}

@media (max-width: 700px) {
    .rp-axis { font-size: 13px; }
    .rp-tip-title, .rp-tip-prev { font-size: 13px; }
    .rp-filters { padding: 14px; gap: 14px; }
    .rp-filter-group { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
    .rp-dates { width: 100%; }
    .rp-dates .rx-select { flex: 1 1 0; width: auto; min-width: 0; }
    .rp-category .rx-select { width: 100%; }
    .rp-export { width: 100%; }
    .rp-export .btn-primary { flex: 1 1 auto; }
    .rp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .rp-kpi { padding: 14px 14px 12px; }
    .rp-kpi-value { font-size: 20px; }
    .rp-spark { display: none; }
    .rp-grid-bar { padding: 16px 14px 10px; }
    .rp-grid-tools { width: 100%; }
    .rp-search { flex: 1 1 100%; }
    .rp-search input { width: 100%; }
    .rp-scroll { max-height: 70vh; }
    .rp-table td, .rp-sort { padding-left: 11px; padding-right: 11px; }
    /* The first column stays in view while you swipe across the numbers. */
    .rp-table th:first-child, .rp-table td.rp-first { position: sticky; left: 0; z-index: 2; box-shadow: 1px 0 0 var(--color-border-soft); }
    .rp-table th:first-child { z-index: 4; }
    .rp-table td.rp-first { background: #FFFFFF; max-width: 170px; }
    .rp-table tbody tr:hover td.rp-first { background: #F1F8F4; }
    .rp-totals td.rp-first { background: #EAF3EE; }
    .rp-foot { padding: 12px 14px 16px; }
    .rp-hbar { grid-template-columns: minmax(80px, 40%) minmax(0, 1fr) auto; }
}
