/* Power BI-style report look for the public demos (browser recreations, fictional data). */
:root {
  --pbi-canvas: #f3f2f1;
  --pbi-card: #ffffff;
  --pbi-border: #e1dfdd;
  --pbi-text: #252423;
  --pbi-muted: #605e5c;
  --pbi-faint: #8a8886;
  --pbi-bar: #252423;
  --pbi-accent: #118dff;
  --pbi-accent-dark: #0b5cad;
  --pbi-navy: #12239e;
  --pbi-orange: #e66c37;
  --pbi-purple: #744ec2;
  --pbi-yellow: #d9b300;
  --pbi-late: #c4314b;
  --pbi-ok: #107c10;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--pbi-canvas);
  color: var(--pbi-text);
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* App bar (like the Power BI service header) */
.pbi-appbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 16px; padding: 8px 20px; background: var(--pbi-bar); color: #fff;
}
.pbi-appbar-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; margin: 0; }
.pbi-logo { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.pbi-logo i { display: block; width: 4px; border-radius: 1px; background: #f2c811; }
.pbi-logo i:nth-child(1) { height: 7px; opacity: .7; }
.pbi-logo i:nth-child(2) { height: 11px; opacity: .85; }
.pbi-logo i:nth-child(3) { height: 16px; }
.pbi-appbar-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: #d2d0ce; }
.pbi-appbar-meta strong { color: #fff; font-weight: 600; }

/* Page tabs */
.pbi-tabs { display: flex; gap: 2px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--pbi-border); overflow-x: auto; scrollbar-width: thin; }
.pbi-tab {
  flex: 0 0 auto; padding: 10px 14px 8px; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--pbi-muted); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.pbi-tab:hover { color: var(--pbi-text); background: #faf9f8; }
.pbi-tab[aria-selected="true"] { color: var(--pbi-text); border-bottom-color: var(--pbi-accent); }
.pbi-tab:focus-visible, .chip:focus-visible, .pbi-btn:focus-visible, .row-toggle:focus-visible,
.stage-card:focus-visible, .bar-row:focus-visible, th button:focus-visible { outline: 2px solid var(--pbi-accent-dark); outline-offset: 2px; }

/* Report canvas */
.pbi-canvas { padding: 14px 20px 24px; display: grid; gap: 12px; }
.pbi-canvas > *, .pbi-row > * { min-width: 0; }
.pbi-page[hidden] { display: none; }
.pbi-page { display: grid; gap: 12px; }
.pbi-page > * { min-width: 0; }
.pbi-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.pbi-row.wide-left { grid-template-columns: 3fr 2fr; }
.pbi-page-lede { margin: 0; font-size: 13px; color: var(--pbi-muted); }

/* Visual card */
.pbi-visual { background: var(--pbi-card); border: 1px solid var(--pbi-border); border-radius: 4px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); min-width: 0; }
.pbi-visual-title { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.pbi-visual-sub { margin: 0 0 10px; font-size: 12px; color: var(--pbi-muted); }
.chart-box { position: relative; height: 220px; }
.chart-fallback { font-size: 13px; color: var(--pbi-muted); padding: 20px 0; }

/* Slicers */
.slicers { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; background: var(--pbi-card); border: 1px solid var(--pbi-border); border-radius: 4px; padding: 10px 14px; }
.slicer { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slicer-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--pbi-muted); }
.slicer select, .slicer input[type="search"] {
  height: 32px; padding: 4px 8px; border: 1px solid #c8c6c4; border-radius: 2px; background: #fff; font-size: 13px; min-width: 140px; max-width: 100%;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid #c8c6c4; border-radius: 2px;
  background: #fff; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip::before { content: ""; width: 12px; height: 12px; border: 1px solid #8a8886; border-radius: 2px; background: #fff; flex: 0 0 auto; }
.chip[aria-pressed="true"] { border-color: var(--pbi-accent); background: #eef6ff; }
.chip[aria-pressed="true"]::before { background: var(--pbi-accent); border-color: var(--pbi-accent); box-shadow: inset 0 0 0 2px #fff; }
.chip .count { color: var(--pbi-muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; height: 32px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--pbi-accent); margin: 0; }
.pbi-btn { height: 32px; padding: 0 12px; border: 1px solid #c8c6c4; border-radius: 2px; background: #fff; cursor: pointer; font-size: 13px; }
.pbi-btn:hover { background: #f3f2f1; }
.slicer-foot { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: -2px; }
.slicer-status { margin: 0; font-size: 12px; color: var(--pbi-muted); }
.pbi-btn-sm { height: 26px; padding: 0 10px; font-size: 12px; flex: 0 0 auto; }

/* KPI cards */
.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--pbi-card); border: 1px solid var(--pbi-border); border-radius: 4px; padding: 10px 14px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--pbi-muted); }
.kpi-value { font-size: 30px; font-weight: 300; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-value.is-late { color: var(--pbi-late); }
.kpi-sub { font-size: 12px; color: var(--pbi-muted); margin-top: 2px; }

/* HTML bar visuals (clickable cross-filters) */
.bars { display: grid; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: minmax(84px, 34%) 1fr; align-items: center; gap: 10px; padding: 4px 6px; margin: 0 -6px;
  border: 0; background: none; text-align: left; cursor: pointer; border-radius: 3px; width: calc(100% + 12px);
}
.bar-row:hover { background: #f3f2f1; }
.bar-row.is-dim { opacity: .45; }
.bar-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.bar-area { min-width: 0; }
.bar-fill { display: block; height: 18px; border-radius: 1px; background: var(--pbi-accent); min-width: 2px; }
.bar-val { font-size: 12px; color: var(--pbi-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-legend { margin: 8px 0 0; font-size: 12px; color: var(--pbi-muted); }

/* Tables */
.table-wrap { overflow: auto; max-height: 460px; border: 1px solid var(--pbi-border); border-radius: 2px; -webkit-overflow-scrolling: touch; }
.pbi-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pbi-table th {
  position: sticky; top: 0; z-index: 1; background: #f3f2f1; text-align: left; font-weight: 600; font-size: 12px; color: var(--pbi-text);
  padding: 0; border-bottom: 1px solid #c8c6c4; white-space: nowrap;
}
.pbi-table th > span, .pbi-table th > button { display: block; width: 100%; padding: 8px 10px; text-align: inherit; }
.pbi-table th button { border: 0; background: none; font-weight: 600; font-size: 12px; cursor: pointer; }
.pbi-table th button:hover { background: #e9e8e7; }
.pbi-table th[aria-sort="ascending"] button::after { content: " \2191"; }
.pbi-table th[aria-sort="descending"] button::after { content: " \2193"; }
.pbi-table td { padding: 7px 10px; border-bottom: 1px solid #edebe9; white-space: nowrap; vertical-align: middle; }
.pbi-table tbody tr:hover td { background: #faf9f8; }
.pbi-table .num { text-align: right; }
.pbi-table tfoot td { position: sticky; bottom: 0; background: #f3f2f1; font-weight: 600; border-top: 1px solid #c8c6c4; }
.pbi-table tr.detail td { background: #faf9f8; white-space: normal; padding: 6px 10px 10px 34px; }
.pbi-table .muted { color: var(--pbi-faint); }
.pbi-table .wrap { white-space: normal; min-width: 180px; }
.lines-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 12px; color: var(--pbi-muted); }
.lines-list b { color: var(--pbi-text); font-weight: 600; }
.row-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; font-weight: 600; color: var(--pbi-accent-dark); }
.row-toggle::before { content: ""; width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; }
.row-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.empty { padding: 24px 10px; text-align: center; color: var(--pbi-muted); white-space: normal !important; }
.table-note { margin: 8px 0 0; font-size: 12px; color: var(--pbi-muted); }

/* Status badges and aging cells */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: #edebe9; color: #3b3a39; }
.badge-blue { background: #deecf9; color: #0b4a8a; }
.badge-amber { background: #fff4ce; color: #6d5700; }
.badge-purple { background: #ebe5f7; color: #4b2d8f; }
.badge-green { background: #dff6dd; color: #0b5a0b; }
.badge-red { background: #fde7e9; color: #a4262c; }
.age { display: inline-block; min-width: 38px; padding: 1px 6px; border-radius: 2px; text-align: right; font-weight: 600; }
.age-0 { background: #dff6dd; color: #0b5a0b; }
.age-1 { background: #fff9db; color: #6d5700; }
.age-2 { background: #fde7d4; color: #8a3a00; }
.age-3 { background: #fde7e9; color: #a4262c; }
.late { color: var(--pbi-late); font-weight: 600; }
.pct { display: inline-flex; align-items: center; gap: 6px; }
.pct-track { width: 60px; height: 8px; background: #edebe9; border-radius: 1px; overflow: hidden; }
.pct-track i { display: block; height: 100%; background: var(--pbi-accent); }

/* Warehouse flow strip */
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stage-card {
  position: relative; text-align: left; border: 1px solid var(--pbi-border); border-top: 4px solid var(--stage, var(--pbi-accent));
  border-radius: 4px; background: #fff; padding: 10px 12px 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06); min-width: 0;
}
.stage-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.14); }
.stage-step { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--pbi-muted); }
.stage-name { font-size: 15px; font-weight: 600; margin-top: 2px; }
.stage-value { font-size: 28px; font-weight: 300; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stage-unit { font-size: 12px; color: var(--pbi-muted); }
.stage-detail { font-size: 12px; color: var(--pbi-text); margin-top: 6px; }
.stage-detail .late { font-weight: 600; }
.flow .stage-card:not(:last-child)::after {
  content: ""; position: absolute; right: -9px; top: 50%; width: 8px; height: 8px; border-top: 2px solid #a19f9d; border-right: 2px solid #a19f9d;
  transform: translateY(-50%) rotate(45deg); z-index: 1;
}

/* Footnote */
.pbi-footnote { margin: 0; font-size: 12px; color: var(--pbi-muted); }

/* Responsive */
@media (max-width: 1000px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pbi-row, .pbi-row.wide-left { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow .stage-card::after { display: none; }
}
@media (max-width: 640px) {
  .pbi-appbar { padding: 8px 14px; }
  .pbi-tabs { padding: 0 6px; }
  .pbi-tab { padding: 10px 9px 8px; }
  .pbi-canvas { padding: 10px 12px 20px; gap: 10px; }
  .pbi-page { gap: 10px; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 24px; }
  .stage-value { font-size: 22px; }
  .slicers { padding: 10px; gap: 10px; }
  .slicer { flex: 1 1 200px; }
  .slicer select, .slicer input[type="search"] { width: 100%; min-width: 0; }
  .table-wrap { max-height: 420px; }
  .demo-intro { padding: 12px 14px; }
}
