/* Atlas Reality reports. Page look follows the Sigma workbooks: light grey page, white cards with a per-section
   accent colour on the heading and card borders, charcoal or accent-filled cards where Sigma used them. */
:root {
  --bg: #f2f2f2; --card: #fcfcfc; --border: #e4e4e7; --text: #18181b; --muted: #71717a;
  --link: #1d4ed8; --positive: #16a34a; --negative: #ef4444; --accent: #c9c9cc; --dark: #545454;
  --info-bg: #eff6ff; --info-border: #bfdbfe; --warn-bg: #fffbeb; --warn-border: #fde68a;
  --radius: 6px; --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: #f4f4f5; padding: 0 4px; border-radius: 4px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: #154886; }
.runmeta { font-size: 0.85rem; color: var(--muted); }
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.layout.no-nav { grid-template-columns: minmax(0, 1fr); }
.sidenav { border-right: 1px solid var(--border); padding: 16px 12px; background: #fff; position: sticky; top: 48px; height: calc(100vh - 48px); overflow-y: auto; font-size: 0.9rem; }
/* report groups (Marketing, Operations, Support ...) are collapsible dropdowns; the active page's group starts open */
.navgroup { margin: 6px 0 2px; }
.navgroup > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; list-style: none; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); user-select: none; }
.navgroup > summary::-webkit-details-marker { display: none; }
/* the chevron is a bordered square corner: closed it points right (rotated 45deg from its top-right corner), open it
   turns a quarter further to point down. Explicit inline-block so the transform applies in every browser, even
   where <summary> keeps its own display. */
.navgroup > summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 6px 0 4px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 0.15s; flex: none; }
.navgroup[open] > summary::after { transform: rotate(135deg); margin-top: -3px; }
.navgroup > summary:hover { background: #f4f4f5; color: var(--text); }
.navgroup > .navlink { margin-left: 8px; }
.navlink { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text); }
.navlink:hover { background: #f4f4f5; text-decoration: none; }
.navlink.active { background: #e8eef7; color: #154886; font-weight: 600; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.foot { padding: 16px 28px; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); background: #fff; }
h1 { font-size: 1.9rem; margin: 0 0 6px; font-weight: 500; }
h1 .title-suffix { font-weight: 400; color: var(--muted); }
h2 { font-size: 1.75rem; font-weight: 500; margin: 30px 0 10px; color: var(--accent); }
.section:not(.accented) h2 { color: var(--text); }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.subtitle, .prose { color: #3f3f46; max-width: 1000px; }
.prose p, .subtitle p { margin: 8px 0; }
.muted { color: var(--muted); }
.bad { color: var(--negative); }
.section { margin-bottom: 8px; }
/* cards size to their content, so a KPI tile beside a tall chart keeps no empty space; `stretch: true` fills the row */
.row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 14px; margin: 12px 0; align-items: start; }
.col { min-width: 0; grid-column: span var(--span, 1); }
.col.col-stretch { align-self: stretch; }
.col.card > .bigvalue:first-child { margin-top: 0; }
.col.card > .chart:last-child, .col.card > .table-block:last-child { margin-bottom: 0; }
.col.card > .chart > .plotly-graph-div, .col.card > .chart > .plotly-graph-div > .js-plotly-plot { width: 100% !important; }
.col.card, .card { background: var(--card); border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.col.card-dark, .card-dark { background: var(--dark); color: #fff; }
.col.card-accent, .card-accent { background: var(--accent); }
.text-light { color: #fff; }
.card-dark .bv-title, .card-dark .block-title, .text-light .bv-title, .text-light .block-title { color: #fff; }
.card-dark .bv-text, .text-light .bv-text { color: rgba(255,255,255,0.85); }
.al-center { text-align: center; }
.col.al-center .bigvalue { padding: 14px 0; }
.chart { margin: 8px 0 12px; min-width: 0; }
.block-head { margin-bottom: 4px; }
.block-title { font-weight: 500; font-size: 1.05rem; }
.block-subtitle { font-size: 0.82rem; color: var(--muted); }
/* block filters: a compact control bar to the right of the title (its own line when the block is narrow).
   Date buttons and series pills are pill buttons; selects are pill-shaped dropdowns; everything is client-side. */
.block-head.has-filters { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 16px; margin-bottom: 6px; }
.block-head.has-filters .block-titles { flex: 1 1 auto; min-width: 0; }
.block-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 14px; margin-left: auto; font-size: 0.85rem; }
.filter { display: inline-flex; align-items: center; gap: 6px; }
.filter-label { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.pills { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.pill { font: inherit; font-size: 0.8rem; line-height: 1.4; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--muted); cursor: pointer; white-space: nowrap; }
.pill:hover { background: #f4f4f5; color: var(--text); }
.pill:focus-visible, .filter-select select:focus-visible { outline: 2px solid #bfdbfe; outline-offset: 0; }
.filter-date .pill.active, .filter-switch .pill.active { background: #e8eef7; border-color: #93c5fd; color: #154886; font-weight: 600; }
.filter-series .pill { padding-left: 8px; }
.filter-series .pill::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; border: 1.5px solid var(--swatch, var(--muted)); background: var(--swatch, var(--muted)); vertical-align: 0; }
.filter-series .pill[aria-pressed="true"] { color: var(--text); }
.filter-series .pill[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.filter-series .pill[aria-pressed="false"]::before { background: transparent; }
.pill-link { font: inherit; font-size: 0.78rem; padding: 2px 5px; border: 0; background: none; color: var(--link); cursor: pointer; }
.pill-link:hover { text-decoration: underline; }
.filter-select select { font: inherit; font-size: 0.82rem; padding: 3px 26px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2371717a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; color: var(--text); cursor: pointer; max-width: 240px; appearance: none; -webkit-appearance: none; }
.block-filters .table-search { width: min(220px, 100%); padding: 3px 10px; font-size: 0.82rem; border-radius: 999px; }
/* the custom from / to pair after the date buttons */
.date-custom { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.date-custom input { font: inherit; font-size: 0.78rem; padding: 2px 6px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text); }
.date-sep { font-size: 0.78rem; color: var(--muted); }
/* block tools: "view data" on charts, CSV on tables. In the head row when the block has one; otherwise overlaid on
   the block's top-right corner, faint until the block is hovered. Never printed. */
.block-tools { display: inline-flex; align-items: center; gap: 4px; }
.block-filters .block-tools { margin-left: 2px; }
.block-tool { width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.block-tool:hover { color: var(--text); background: #f4f4f5; }
.block-tool svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chart, .table-block { position: relative; }
.block-tools.overlay { position: absolute; top: 2px; right: 2px; z-index: 2; opacity: 0.35; }
.chart:hover .block-tools.overlay, .table-block:hover .block-tools.overlay, .block-tools.overlay:focus-within { opacity: 1; }
.card-dark .block-tool, .text-light .block-tool { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); color: #fff; }
/* the data view: a dialog over the page with the chart's numbers as a table and a CSV button */
.data-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.data-modal[hidden] { display: none; }
.data-box { background: #fff; border-radius: 8px; width: min(1100px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.data-box:focus { outline: none; }
.data-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-title { font-weight: 600; }
.data-actions { display: flex; align-items: center; gap: 10px; }
.data-count { font-size: 0.85rem; color: var(--muted); }
.data-csv { font: inherit; font-size: 0.85rem; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--link); cursor: pointer; }
.data-csv:hover { background: #f4f4f5; }
.data-close { font: inherit; font-size: 1.3rem; line-height: 1; padding: 2px 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.data-body { overflow: auto; padding: 0 16px 16px; }
.data-body table { font-size: 0.85rem; }
.card-dark .filter-label, .text-light .filter-label { color: rgba(255,255,255,0.75); }
.card-dark .pill, .text-light .pill, .card-dark .filter-select select, .text-light .filter-select select { background-color: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); color: #fff; }
.card-dark .pill:hover, .text-light .pill:hover { background-color: rgba(255,255,255,0.18); }
.card-dark .filter-date .pill.active, .text-light .filter-date .pill.active { background-color: #fff; color: #154886; border-color: #fff; }
.card-dark .pill-link, .text-light .pill-link { color: #bfdbfe; }
.bigvalue { margin: 2px 0 6px; }
.bv-title { font-size: 1.02rem; color: var(--text); font-weight: 500; }
.bv-value { font-size: 1.75rem; font-weight: 600; line-height: 1.25; }
.bv-xl .bv-value { font-size: 1.75rem; }
.bv-delta { font-size: 0.85rem; margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.bv-delta .arrow { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.bv-delta.good { color: var(--positive); }
.bv-delta.good .arrow { background: rgba(22,163,74,0.14); }
.bv-delta.bad { color: var(--negative); }
.bv-delta.bad .arrow { background: rgba(239,68,68,0.14); }
.bv-delta.flat { color: var(--muted); }
.bv-text { color: var(--muted); }
.value-line { font-weight: 600; margin: 4px 0; }
.callout { border: 1px solid var(--info-border); background: var(--info-bg); border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; font-size: 0.92rem; }
.callout-warning { border-color: var(--warn-border); background: var(--warn-bg); }
.callout-positive { border-color: #bbf7d0; background: #f0fdf4; }
.callout-negative { border-color: #fecaca; background: #fef2f2; }
.callout-title { font-weight: 600; margin-bottom: 4px; }
.callout-body p { margin: 4px 0; }
.table-block { margin: 12px 0 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
.table-compact .table-wrap { width: fit-content; min-width: min(400px, 100%); max-width: 100%; }
.table-compact table { width: 100%; }
.table-compact th, .table-compact td { padding-left: 20px; padding-right: 20px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* a column with wrap: true (long text such as a reason or next step) wraps instead of stretching the table */
th.col-wrap, td.col-wrap { white-space: normal; min-width: 9rem; max-width: 22rem; }
th { background: #f4f4f5; font-weight: 600; position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #e9e9ec; }
th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 0.7em; color: var(--muted); }
th[aria-sort="descending"]::after { content: " \25BC"; font-size: 0.7em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 600; background: #f4f4f5; border-top: 1px solid var(--border); }
.al-left { text-align: left; } .al-right { text-align: right; } .al-center { text-align: center; }
table.pivot th:first-child, table.pivot td:first-child { position: sticky; left: 0; background: inherit; }
.table-note { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.table-tools { display: flex; justify-content: flex-end; margin: 4px 0 8px; }
.table-search { font: inherit; font-size: 0.86rem; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); width: min(280px, 100%); }
.table-search:focus { outline: 2px solid #bfdbfe; outline-offset: 0; border-color: #93c5fd; }
.table-block.is-collapsed tbody > tr.tr-extra { display: none; }
.table-toggle { font: inherit; font-size: 0.82rem; margin-top: 6px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--link); cursor: pointer; }
.table-toggle:hover { background: #f4f4f5; }
/* trees (the `tree` block): nested <details>, one row per node, the measures right-aligned in columns after the
   label; each level indents by --depth and the chevron sits before the label like the sidebar groups. */
.tree-block { margin: 12px 0 16px; }
.tree { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-size: 0.86rem; overflow-x: auto; }
.tree-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--nvals, 1), minmax(96px, max-content)); align-items: center; gap: 0 16px; padding: 5px 12px 5px calc(12px + var(--depth, 0) * 22px); border-bottom: 1px solid var(--border); }
.tree-head { background: #f4f4f5; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.tree-total { font-weight: 600; background: #fafafa; }
.tree-node > summary { cursor: pointer; list-style: none; user-select: none; }
.tree-node > summary::-webkit-details-marker { display: none; }
.tree-node > summary:hover { background: #f8f8f8; }
.tree-node > summary > .tree-label::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 9px 1px 0; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.tree-node[open] > summary > .tree-label::before { transform: rotate(135deg); margin-bottom: 3px; }
.tree-leaf > .tree-label { padding-left: 15px; color: #3f3f46; }
.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: #e8eef7; color: #154886; font-size: 0.72rem; font-weight: 600; vertical-align: 1px; }
.tree-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tree-hide { display: none; }
.tree-node:last-child > summary.tree-row, .tree > .tree-leaf:last-child, .tree-children > .tree-leaf:last-child { border-bottom-color: var(--border); }
.tree > :last-child > summary.tree-row, .tree > .tree-leaf:last-child { border-bottom: 0; }
/* tabs: one panel at a time on screen, all of them in print (each under its title). Inactive panels stay in the
   layout at full width but invisible and zero height, so the charts inside render at the right size from the start. */
.tabs { margin: 12px 0; position: relative; }
.tabbar { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab { font: inherit; font-size: 0.9rem; padding: 7px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: #f4f4f5; }
.tab.active { color: #154886; border-bottom-color: #154886; font-weight: 600; }
.tabpanel { position: absolute; left: 0; right: 0; top: 0; height: 0; overflow: hidden; visibility: hidden; }
.tabpanel.active { position: static; height: auto; overflow: visible; visibility: visible; }
.tab-print-title { display: none; }
.reportlist { list-style: none; padding: 0; margin: 0 0 16px; }
.reportlist li { padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: baseline; }
/* scoped to the list: an unscoped `.pill` here would override the filter-bar pills above (same specificity, later) */
.reportlist .pill { font-size: 0.75rem; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px; }
}
@page { size: Letter landscape; margin: 10mm 8mm; }
@media print {
  /* the PDF prints at 65% (pdf.py), so the base size is larger than on screen to keep text at a readable ~8.5pt */
  html { font-size: 13px; }
  body { background: #fff; }
  .topbar, .sidenav, .foot a, .runmeta a { display: none; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .foot { border: 0; padding: 8px 0; }
  .col.card, .card, .chart, .table-block, .callout, .bigvalue { break-inside: avoid; page-break-inside: avoid; }
  .card-dark, .card-accent { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h2 { break-after: avoid; page-break-after: avoid; }
  .section.keep-together { break-inside: avoid; page-break-inside: avoid; }
  .row { gap: 10px; }
  .table-wrap { overflow: visible; }
  th { position: static; }
  .table-tools, .table-toggle, .table-match, .tabbar, .block-filters, .block-tools, .data-modal { display: none; }
  .block-head.has-filters { display: block; }
  .table-block tbody > tr[hidden], .table-block.is-collapsed tbody > tr.tr-extra { display: table-row; }
  .table-block tbody > tr.tr-out { display: none !important; }  /* outside a table's date range, collapsed or not */
  .tabpanel { position: static; height: auto; overflow: visible; visibility: visible; }
  .tab-print-title { display: block; margin: 14px 0 6px; font-size: 1.05rem; break-after: avoid; page-break-after: avoid; }
  table.pivot th:first-child, table.pivot td:first-child { position: static; }
  .tree { overflow: visible; }
  .tree-head { position: static; }
  .tree-row { break-inside: avoid; page-break-inside: avoid; }
  .tree-hide { display: grid; }
  .tree-match { display: none; }
  a { color: inherit; }
}
