/* Lugoda Sentinel — Reports & Analytics. Report tab bar, inline-SVG donut/bar charts,
   report cards, export/print toolbar, and a print stylesheet that turns the active
   report into a clean black-on-white document. Reuses theme tokens + components. */

/* ---------- report-type tab bar ---------- */
.rp-tabs{
  display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:16px;
}
@media(max-width:1100px){.rp-tabs{grid-template-columns:repeat(3,1fr)}}
@media(max-width:640px){.rp-tabs{grid-template-columns:repeat(2,1fr)}}
.rp-tab{
  display:flex;align-items:flex-start;gap:10px;text-align:left;cursor:pointer;
  background:var(--panel);border:1px solid var(--line);border-radius:12px;
  padding:12px 13px;color:var(--txt);transition:.15s;position:relative;overflow:hidden;
}
.rp-tab::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:transparent;transition:.15s}
.rp-tab:hover{border-color:#50505c;transform:translateY(-1px)}
.rp-tab.on{border-color:var(--red);background:#241417}
.rp-tab.on::before{background:var(--red)}
.rp-ti{font-size:20px;line-height:1;flex:0 0 auto}
.rp-tt{display:flex;flex-direction:column;min-width:0}
.rp-tt b{font-size:13px;line-height:1.2}
.rp-tt em{font-size:10.5px;color:var(--muted);font-style:normal;margin-top:3px;line-height:1.3}
.rp-tab.on .rp-tt em{color:#d9a9ac}

/* ---------- toolbar: filters + export/print ---------- */
.rp-toolbar{
  display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;
  background:var(--panel);border:1px solid var(--line);border-radius:12px;
  padding:12px 14px;margin-bottom:16px;
}
.rp-filters{display:flex;gap:14px;flex-wrap:wrap}
.rp-fl{display:flex;flex-direction:column;gap:5px;font-size:10px;text-transform:uppercase;
  letter-spacing:1px;color:var(--muted)}
.rp-fl select{
  background:var(--panel2);border:1px solid var(--line);color:var(--txt);
  border-radius:8px;padding:8px 11px;font-size:13px;min-width:170px;cursor:pointer;
}
.rp-fl select:focus{outline:none;border-color:var(--red)}
.rp-actions{display:flex;gap:9px}

/* ---------- report container + header strip ---------- */
.rp-report{animation:slidein .25s ease}
.rp-rh{
  display:flex;align-items:center;gap:13px;margin-bottom:14px;padding:13px 16px;
  background:linear-gradient(90deg,#241417,#1f1f25);border:1px solid var(--line);
  border-left:3px solid var(--red);border-radius:12px;
}
.rp-rh-ic{font-size:24px;line-height:1}
.rp-rh h3{font-size:17px}
.rp-rh .muted{font-size:12px}
.rp-rh-date{margin-left:auto;font-size:12px;color:var(--muted);
  font-variant-numeric:tabular-nums;white-space:nowrap}

.rp-kpis{grid-template-columns:repeat(4,1fr)}
@media(max-width:900px){.rp-kpis{grid-template-columns:repeat(2,1fr)}}

.rp-grid{margin-bottom:16px}
.rp-card{margin-bottom:16px}
.rp-card:last-child{margin-bottom:0}

/* ---------- charts: shared ---------- */
.rp-chart{padding:6px 2px}

/* donut */
.rp-donut-wrap{display:flex;align-items:center;gap:18px;flex-wrap:wrap;justify-content:center}
.rp-donut{flex:0 0 auto}
.don-seg{transition:stroke-dasharray .5s ease;stroke-linecap:butt}
.don-c{fill:var(--txt);font-size:30px;font-weight:700;font-family:'Segoe UI',system-ui,sans-serif}
.don-cs{fill:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:1px}
.rp-legend{display:flex;flex-direction:column;gap:8px;font-size:12.5px;min-width:150px}
.rp-lg{display:flex;align-items:center;gap:8px;color:#d6d6dc}
.rp-lg .sq{width:11px;height:11px;border-radius:3px;flex:0 0 auto}
.rp-lg b{margin-left:auto;color:var(--txt);font-variant-numeric:tabular-nums}
.rp-lg em{color:var(--muted);font-style:normal;font-size:11px;min-width:42px;text-align:right}

/* horizontal bars */
.rp-bars{display:flex;flex-direction:column;gap:11px}
.rp-bar{display:grid;grid-template-columns:130px 1fr 64px;align-items:center;gap:12px}
.rp-bl{font-size:12.5px;color:#d6d6dc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rp-bt{height:14px;background:#2a2a32;border-radius:7px;overflow:hidden}
.rp-bf{display:block;height:100%;border-radius:7px;min-width:2px;
  transition:width .5s ease;background:var(--red)}
.rp-bv{font-size:12.5px;font-weight:700;text-align:right;color:var(--txt);
  font-variant-numeric:tabular-nums}
@media(max-width:520px){.rp-bar{grid-template-columns:96px 1fr 50px;gap:8px}.rp-bl{font-size:11px}}

/* table wrapper inside report cards (horizontal scroll on small screens) */
.rp-tbl-wrap{overflow-x:auto}

/* loading state (async live-assurance fetch) */
.rp-loading{display:flex;align-items:center;gap:10px;justify-content:center;
  padding:40px;color:var(--muted);font-size:13px}
.rp-spin{width:16px;height:16px;border-radius:50%;border:2px solid var(--line);
  border-top-color:var(--red);animation:rp-spin .8s linear infinite}
@keyframes rp-spin{to{transform:rotate(360deg)}}

/* ============================================================
   PRINT — turn the active report into a clean A4 document.
   Hide app chrome (header, nav, footer, toolbar, tabs); render
   charts + tables black-on-white; force light backgrounds.
   ============================================================ */
@media print{
  @page{margin:14mm;size:auto}

  /* hide everything that is not the report */
  header.top,nav.portnav,footer,.rp-tabs,.rp-toolbar,
  .live-pill,.zica,.clock,.btn{display:none !important}

  html,body{background:#fff !important;color:#000 !important}
  main.view{padding:0 !important}

  .view-head h2{color:#000 !important}
  .view-head .sub,.muted,.rp-rh .muted{color:#444 !important}
  .line-badge{border:1px solid #aaa !important;background:#fff !important;color:#000 !important}

  /* report header strip -> plain rule */
  .rp-rh{background:#fff !important;border:none !important;border-bottom:2px solid #000 !important;
    border-radius:0 !important;padding:0 0 8px !important;margin-bottom:14px !important}
  .rp-rh h3{color:#000 !important}
  .rp-rh-date{color:#000 !important}

  /* cards -> bordered light blocks; avoid breaking across pages */
  .card,.rp-card{background:#fff !important;border:1px solid #999 !important;
    box-shadow:none !important;break-inside:avoid;page-break-inside:avoid;margin-bottom:12px !important}
  .card h3.ch{color:#000 !important;border-bottom:1px solid #bbb !important;background:#f2f2f2 !important}

  /* KPI tiles -> light boxes with visible values */
  .kpi,.rp-kpis .kpi{background:#fff !important;border:1px solid #999 !important;
    break-inside:avoid;page-break-inside:avoid}
  .kpi .label,.kpi .sub{color:#444 !important}
  .kpi .val,.kpi.good .val,.kpi.warn .val,.kpi.alarm .val{color:#000 !important}

  /* charts keep their fills (print-color-adjust) so segments/bars stay readable */
  .rp-chart,.rp-donut,.rp-bars,.rp-bf,.don-seg,.pill,.kpi .bar{
    -webkit-print-color-adjust:exact !important;print-color-adjust:exact !important}
  .don-c{fill:#000 !important}
  .don-cs,.rp-lg em{fill:#444 !important;color:#444 !important}
  .rp-lg,.rp-bl,.rp-bv{color:#000 !important}
  .rp-bt{background:#e6e6e6 !important}

  /* tables -> classic black-on-white */
  table.tbl{color:#000 !important}
  table.tbl th{color:#000 !important;border-bottom:1px solid #000 !important;background:#f2f2f2 !important}
  table.tbl td{border-bottom:1px solid #ccc !important}
  table.tbl tr{break-inside:avoid;page-break-inside:avoid}

  /* pills -> outlined chips that read in grayscale too */
  .pill{border:1px solid #777 !important;color:#000 !important;background:#fff !important}

  .grid2,.grid3{display:grid !important}

  /* force the active report to expand fully */
  .rp-report{animation:none !important}
}
