/* Polish: one professional visual system for every page. Additive. Load LAST (after app.css, tiles.css, side-panels.css, toolbar.css, sidebar-fold.css).
   Principles: one accent, neutral cool greys, one typeface (Inter), LEAN density (4-10px padding, 26-30px controls, 12px text, 8px radius), soft borders, clear hierarchy, obvious active states.
   Source of truth for the look: the "Analytics Canada UI Interactive" Artifact (Foundations board). To rebrand, change the tokens in :root only. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root{
  --ink:#0f172a; --mut:#64748b; --line:#e2e8f0; --line-2:#eef2f6; --bg:#f5f7fa; --surface:#fff;
  --acc:#2563eb; --accd:#1d4ed8; --acc-soft:#eff4ff; --acc-ring:rgba(37,99,235,.18); --bar:#86a8f4;
  --pos:#15803d; --pos-bg:#ecfdf3; --neg:#b91c1c; --neg-bg:#fef2f2;
  --radius:8px; --shadow:0 1px 2px rgba(15,23,42,.04);
  --mono:'Inter',system-ui,sans-serif;
  --chev:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'><path d='M1.5 3.5 5 7l3.5-3.5' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* ---------- Base ---------- */
body{background:var(--bg);color:var(--ink);font:400 12px/1.45 'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased}
body *{scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}
body a{color:var(--acc)}body a:hover{color:var(--accd)}
body :focus-visible{outline:2px solid var(--acc);outline-offset:2px}
body .mut{color:var(--mut)}

/* ---------- Sidebar ---------- */
body .app{grid-template-columns:200px minmax(0,1fr)}
body .app.side-folded{grid-template-columns:64px minmax(0,1fr)}
body aside{position:sticky;top:0;height:100vh;overflow-y:auto;background:#fff;border-right:1px solid var(--line);padding:10px 8px;gap:2px}
body aside .logo{gap:8px;padding:2px 6px 8px;font-size:14px;font-weight:700;letter-spacing:-.01em;color:var(--ink)}
body aside .logo i{position:relative;flex:none;width:22px;height:22px;border-radius:6px;background:linear-gradient(145deg,#3b82f6,#1d4ed8);box-shadow:0 1px 2px rgba(29,78,216,.35)}
body aside .logo i::after{content:"";position:absolute;inset:5px;background:linear-gradient(#fff,#fff) 0 100%/3px 6px no-repeat,linear-gradient(#fff,#fff) 50% 100%/3px 12px no-repeat,linear-gradient(#fff,#fff) 100% 100%/3px 9px no-repeat}
body aside .fold{top:8px;right:4px;width:24px;height:24px;color:var(--mut)}
body aside .fold:hover{background:#f1f5f9;color:var(--ink)}
body aside a.n{height:28px;padding:0 8px;gap:8px;border-radius:6px;color:#475569;font-size:12.5px;font-weight:500;transition:background .12s,color .12s}
body aside a.n .ico{width:15px;height:15px;color:#94a3b8;transition:color .12s}
body aside a.n:hover{background:#f1f5f9;color:var(--ink)}
body aside a.n:hover .ico{color:var(--mut)}
body aside a.n.on{background:var(--acc-soft);color:var(--accd);font-weight:600}
body aside a.n.on .ico{color:var(--acc)}
body aside .sub{margin:8px 8px 2px;font-size:10px;font-weight:600;letter-spacing:.08em;color:var(--mut)}
body aside .lang{margin-top:auto;align-self:stretch}
body aside .lang a{flex:1;justify-content:center;cursor:pointer}
body aside .ft{margin-top:8px;padding:8px 8px 0;border-top:1px solid var(--line);font-family:inherit;font-size:11px;line-height:1.5;color:var(--mut)}
body aside .lang + .ft{margin-top:8px}
body .side-folded aside .lang{display:none}
body .side-folded aside .logo{padding:2px 0 10px}

/* ---------- Page frame and title bar ---------- */
body main{width:100%;max-width:1680px;margin-inline:auto;padding:12px 16px 24px;gap:8px}
body .top{height:auto;margin:0 0 -4px}
body .bar{height:auto;min-height:26px;flex-wrap:wrap;gap:6px 10px}
body .bar h1{margin:0 auto 0 0;font-size:18px;line-height:1.25;font-weight:700;letter-spacing:-.02em;color:var(--ink)}
body .bar h1:has(+ .mut){margin-right:0}
body .bar h1 + .mut{margin-right:auto;font-size:12px;color:#475569}

/* ---------- Controls ---------- */
/* Segmented control (pill) */
body .seg{display:inline-flex;gap:1px;padding:2px;border:0;border-radius:7px;background:#e9edf3;overflow:visible}
body .seg button,body .seg a{box-sizing:border-box;display:inline-flex;align-items:center;height:24px;padding:0 10px;border:0;border-radius:5px;background:none;color:#475569;font-size:12px;font-weight:500;line-height:1;white-space:nowrap;cursor:pointer;transition:background .12s,color .12s}
body .seg button:hover:not(.on),body .seg a:hover:not(.on){background:rgba(255,255,255,.65);color:var(--ink)}
body .seg button.on,body .seg a.on{background:#fff;color:var(--ink);font-weight:600;box-shadow:0 1px 2px rgba(15,23,42,.14)}
/* Folder tabs (report tabs and tile tabs): rounded top corners, grey when inactive, the active tab is white, taller, has a blue top edge and opens into the content below */
body #report-tabs,body .tile .hd .tabs{align-items:flex-end;gap:2px;padding:0;border:0;border-radius:0;background:none;box-shadow:inset 0 -1px 0 var(--line);overflow:visible}
body #report-tabs button,body .tile .hd .tabs button{box-sizing:border-box;height:24px;padding:0 10px;margin:0;border:1px solid var(--line);border-radius:6px 6px 0 0;background:#f1f5f9;box-shadow:none;color:#475569;font-weight:500}
body #report-tabs button:hover,body .tile .hd .tabs button:hover{background:#e6ecf4;color:var(--ink)}
body #report-tabs button.on,body .tile .hd .tabs button.on{height:28px;border-bottom-color:#fff;background:#fff;box-shadow:inset 0 2px 0 var(--acc);color:var(--ink);font-weight:600}
body #report-tabs{max-width:100%;overflow-x:auto;scrollbar-width:none}
/* Layout toggles that reuse .tabs-line (Tiers / Masonry) stay as light pills, they are switches, not tabs */
body :is(.bar, .area-tools) .seg.tabs-line{align-self:auto;gap:1px;padding:2px;border:0;border-radius:7px;background:#e9edf3;box-shadow:none}
body :is(.bar, .area-tools) .seg.tabs-line button{height:22px;padding:0 10px;margin:0;border:0;border-radius:5px;background:none;box-shadow:none;color:#475569;font-weight:500}
body :is(.bar, .area-tools) .seg.tabs-line button:hover:not(.on){background:rgba(255,255,255,.65);color:var(--ink)}
body :is(.bar, .area-tools) .seg.tabs-line button.on{background:#fff;color:var(--ink);font-weight:600;box-shadow:0 1px 2px rgba(15,23,42,.14)}
/* Area report: tab strip on the left, layout switch and Export CSV on the right, one shared baseline */
body .area-tools{display:flex;flex-wrap:wrap;align-items:flex-end;gap:4px 10px;box-shadow:inset 0 -1px 0 var(--line)}
body .area-tools #report-tabs{flex:1 1 auto;min-width:0;box-shadow:none}
body .area-tools-r{display:flex;align-items:center;gap:6px;margin-bottom:2px}
/* Buttons and chips */
body .chip,body .btn{box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 10px;border:1px solid var(--line);border-radius:6px;background:#fff;color:var(--ink);font-family:inherit;font-size:12px;font-weight:500;line-height:1;box-shadow:none;cursor:pointer;transition:background .12s,border-color .12s}
body .chip:hover,body .btn:hover{background:#f8fafc;border-color:#cbd5e1;color:var(--ink)}
body input.chip{min-width:220px;font-weight:400;cursor:text}
body input.chip::placeholder,body .tb-search input::placeholder{color:var(--mut)}
body input.chip:focus-visible,body .tb-search input:focus-visible{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px var(--acc-ring)}
body .btn .ico{width:14px;height:14px;color:var(--mut)}
body .btn--primary{width:100%;height:28px;justify-content:center;background:var(--acc);border-color:var(--acc);color:#fff;font-weight:600;box-shadow:0 1px 2px rgba(37,99,235,.35)}
body .btn--primary .ico{color:#fff}
body .btn--primary:hover{background:var(--accd);border-color:var(--accd);color:#fff}
body .btn--ghost{align-self:flex-start;height:24px;padding:0 6px;border-color:transparent;background:none;box-shadow:none;color:#475569}
body .btn--ghost:hover{background:#f1f5f9;border-color:transparent;color:var(--ink)}
body .btn--icon{width:24px;height:24px;padding:0;justify-content:center;border-color:transparent;background:none;box-shadow:none;color:var(--mut)}
body .btn--icon:hover{background:var(--neg-bg);border-color:transparent;color:var(--neg)}
body .btn--icon:hover .ico{color:var(--neg)}
/* Selects and checkboxes */
body select{box-sizing:border-box;height:26px;padding:0 26px 0 8px;border:1px solid var(--line);border-radius:6px;background:#fff var(--chev) no-repeat right 9px center/10px;color:var(--ink);font-family:inherit;font-size:12px;font-weight:500;appearance:none;-webkit-appearance:none;cursor:pointer}
body select.chip{height:26px;border-radius:6px}
body select:hover{background-color:#f8fafc}
body .hd label{display:inline-flex;align-items:center;gap:6px;color:#334155;font-size:12px;cursor:pointer}
body .hd input[type=checkbox]{width:14px;height:14px;margin:0;accent-color:var(--acc)}

/* ---------- Cards and headers ---------- */
body .card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
body .card:has(> table){overflow-x:auto}
body .hd,body .tile .hd{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-height:32px;padding:4px 10px;border-bottom:1px solid var(--line-2);border-radius:0;background:#fff}
body .hd b,body .tile .hd b{color:var(--ink);font-size:13px;font-weight:600;letter-spacing:0}
body .hd .mut{font-size:11px}

/* ---------- KPI row ---------- */
body .kpis,body .kpis.auto{display:grid;grid-auto-flow:row;grid-auto-columns:auto;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;border:0;border-radius:0;background:none;overflow:visible}
body .kpis > div{display:flex;flex-direction:column;gap:0;padding:6px 10px;border:1px solid var(--line);border-radius:var(--radius);background:#fff;box-shadow:var(--shadow)}
body .kpis > div > div{padding:0;background:none}
body .kpis .v{padding:0;background:none;color:var(--ink);font-size:20px;font-weight:700;line-height:1.2;letter-spacing:-.02em}
body .kpis .mut{font-size:11px;font-weight:500}
body .kpis .v ~ .mut{font-weight:400}
body .kpis .d{padding:1px 6px;border-radius:999px;font:600 11px/1.4 'Inter',sans-serif}
body .kpis .d.up{background:var(--pos-bg)}body .kpis .d.dn{background:var(--neg-bg)}
body .up{color:var(--pos);font-weight:500}body .dn{color:var(--neg);font-weight:500}

/* ---------- Tables ---------- */
body table{font-size:12px}
body th{padding:4px 10px;border-bottom:1px solid var(--line);background:#f8fafc;color:var(--mut);font-size:11px;font-weight:500;white-space:nowrap}
body td{padding:3px 10px;border-bottom:1px solid var(--line-2);color:var(--ink);font-family:inherit}
body td:first-child{font-family:inherit}
body td.mono{font-family:inherit;color:#334155}
body tbody tr:last-child td{border-bottom:0}
body tbody tr:hover{background:#f8fafc}
body tbody tr.sel{background:var(--acc-soft)}
body td .bb{height:5px;border-radius:2px;background:var(--bar)}

/* ---------- Tiles ---------- */
body .tiles{gap:8px;grid-auto-rows:24px}
body .tiles--masonry{gap:8px}
body .tiles--masonry .mcol{gap:8px}
body .tile{border-color:var(--line)}
body .tile .hd .ti{box-sizing:content-box;width:16px;height:16px;margin:0;padding:3px;border-radius:6px;background:var(--acc-soft);color:var(--acc)}
body .tile .hd .tg,body .tile .hd .ch{display:grid;place-items:center;width:22px;height:22px;border-radius:6px;color:#94a3b8}
body .tile .hd .tg:hover,body .tile .hd .ch:hover{background:#f1f5f9;color:var(--ink)}
body .tile .hd .ch{color:var(--mut)}
body .tile .hd .ch:hover{color:var(--acc)}
body .tile .hd:has(.tabs){padding-bottom:0;border-bottom:0}
body .tile .hd .tabs{flex:0 0 calc(100% + 20px);margin:4px -10px 0;padding:0 10px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
body .tile .hd .tabs button{flex:none}
body .tile .tf{padding:4px 10px;border-top:1px solid var(--line-2);background:#fafbfc;color:var(--mut);font-size:11px}
body .tile .tf a{color:var(--acc);font-weight:500}
body .tile--collapsed .hd{min-height:32px;height:auto;border-bottom:0}
body .tile.tile--collapsed{grid-row:span 2;align-self:start}
body .lr{grid-template-columns:minmax(0,1fr) 80px 48px;gap:8px;padding:3px 10px;border-bottom:1px solid var(--line-2);color:var(--ink);font-size:12px}
body .lr span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body .lr span:last-child{font-family:inherit;font-weight:500;color:var(--ink)}
body .tile .lr i,body .lr i{height:5px;border-radius:2px;background:var(--bar)}
body .tile .lr:hover,body .lr:hover{background:#f8fafc}

/* ---------- Layout rows ---------- */
body .row{gap:8px}
body .r1{grid-template-columns:minmax(0,1fr) 300px}
body .row.cols{gap:8px}

/* ---------- Maps ---------- */
body #map{background:#f1f5f9}
body #bmap{height:calc(100vh - 150px) !important;min-height:420px !important}
body .leg{padding:6px 8px;border:1px solid var(--line);border-radius:6px;background:rgba(255,255,255,.96);box-shadow:0 2px 6px rgba(15,23,42,.08);font-family:inherit;font-size:11px;line-height:1.3}
body .leg.lg{width:200px;border-color:var(--line);font-family:inherit}
body .leg.lg b{color:var(--ink)}
body .leg.lg .g{height:6px;margin:4px 0 3px;border-radius:3px;background:linear-gradient(90deg,rgba(37,99,235,.1),rgba(37,99,235,.85))}
body .leg.lg .l{font-family:inherit}
body .zoomb{right:12px;top:12px;filter:drop-shadow(0 2px 6px rgba(15,23,42,.12))}
body .zoomb button{width:26px;height:26px;border-color:var(--line);color:var(--ink);font-size:16px;line-height:24px}
body .zoomb button:first-child{border-radius:6px 6px 0 0}
body .zoomb button:last-child{border-radius:0 0 6px 6px}
body #tip{padding:4px 8px;border-radius:6px;font-size:11px;background:var(--ink)}
body #tip span{font-family:inherit;color:#bfd2fb}

/* ---------- Map toolbar ---------- */
body .bar.bar--tall{min-height:26px}
body .toolbar{align-items:flex-end;gap:6px 14px;padding:6px 10px;border-color:var(--line)}
body .tb-g{gap:3px}
body .tb-l{color:#475569;font-size:10px;font-weight:600;letter-spacing:.07em}
body .tb-seg{display:inline-flex;gap:1px;padding:2px;border:0;border-radius:7px;background:#e9edf3;overflow:visible}
body .tb-seg button{height:26px;padding:0 10px;gap:6px;border:0;border-radius:5px;color:#475569;font-size:12px;font-weight:500;transition:background .12s,color .12s}
body .tb-seg button .ico{color:#94a3b8}
body .tb-seg button:hover:not(.on){background:rgba(255,255,255,.65);color:var(--ink)}
body .tb-seg button.on{background:#fff;color:var(--accd);font-weight:600;box-shadow:0 1px 2px rgba(15,23,42,.14)}
body .tb-seg button.on .ico{color:var(--acc)}
body .tb-sel{height:30px;min-width:200px;padding:0 26px 0 8px;border:1px solid var(--line);border-radius:6px;background:#fff var(--chev) no-repeat right 9px center/10px;font-size:12px;font-weight:500;box-shadow:none}
body .tb-sel:hover{background-color:#f8fafc}
body .tb-chips{gap:6px}
body .tb-chip{height:30px;gap:6px;padding:0 10px;border:1px solid var(--line);border-radius:6px;color:#475569;font-size:12px;font-weight:500;box-shadow:none;transition:background .12s,border-color .12s}
body .tb-chip .ico{color:#94a3b8}
body .tb-chip:hover{background:#f8fafc}
body .tb-chip:has(input:checked){border-color:var(--acc);background:var(--acc-soft);color:var(--accd)}
body .tb-chip:has(input:checked) .ico{color:var(--acc)}
body .tb-search .ico{left:9px;margin-top:-7px;width:14px;height:14px;color:#94a3b8}
body .tb-search input{width:280px;height:30px;padding:0 8px 0 30px;border:1px solid var(--line);border-radius:6px;box-shadow:none;font-size:12px;font-weight:400}

/* ---------- Side panels ---------- */
body .side-col{gap:8px}
body .sp .bd{gap:8px;padding:8px 10px}
body .sp .hint{font-size:11px;line-height:1.4}
body .sp .src{font-size:10.5px}
body .n-badge{min-width:20px;padding:0 6px;border-radius:999px;background:var(--acc-soft);color:var(--accd);font:600 11px/18px 'Inter',sans-serif}
body .sr{grid-template-columns:20px minmax(0,1fr) auto;gap:8px;padding:4px 6px;border:1px solid var(--line);border-radius:6px;background:#fff}
body .sr:hover{background:#f8fafc}
body .sr.on,body .sr.on:hover{border-color:var(--acc);background:var(--acc-soft);box-shadow:none}
body .sr .num{width:20px;height:20px;background:var(--acc);font:600 11px/20px 'Inter',sans-serif}
body .sr .t{color:var(--ink);font-weight:600}
body .sr .s{font-size:11px}
body .sr.on .s{color:#475569}
body .sp .stat,body .stat{gap:1px;border:1px solid var(--line);border-radius:6px;background:var(--line);overflow:hidden}
body .stat div{padding:4px 8px;background:#fafbfc}
body .sp .stat .v,body .stat .v{color:var(--ink);font:600 14px/1.2 'Inter',sans-serif}
body .sp .stat .mut{font-size:10px;font-weight:500;letter-spacing:.03em}
body .sp th{background:#f8fafc;color:var(--mut);font-weight:500;border-bottom:1px solid var(--line)}
body .sp td{border-bottom:1px solid var(--line-2)}
body .sp tbody tr:hover{background:#f8fafc}
body .sp td:last-child,body .sp th:last-child{width:32px}

/* ---------- Regional analytics extras ---------- */
body .side{gap:8px;padding:10px}
body .side h2{font-size:16px;font-weight:700;letter-spacing:-.015em}
body .lab{margin-bottom:4px;color:var(--mut);font-size:10px;font-weight:600;letter-spacing:.07em}
body .lab.pad{padding:8px 10px 2px}
body .pad{padding:6px 10px}
body .hbar{grid-template-columns:44px 1fr 40px;gap:8px;margin-bottom:4px;font:11px 'Inter',sans-serif}
body .hbar i{height:6px;border-radius:3px;background:var(--bar)}
body .split{height:8px;border-radius:4px}
body .keys{gap:10px;font-size:11px}
body .minis div{padding:8px}
body .heat{gap:3px;padding:8px 10px;font:11px 'Inter',sans-serif}
body .heat .rl{font-family:inherit}
body .heat div{padding:4px;border-radius:4px}

/* ---------- Notes under pages ---------- */
main > .mut{max-width:920px;font-size:11px;line-height:1.5;color:#475569}

/* ---------- Responsive ---------- */
@media (max-width:1100px){body .r1{grid-template-columns:minmax(0,1fr)}}
@media (max-width:900px){
  body .r3{grid-template-columns:minmax(0,1fr)}
  body main{padding:12px 12px 24px}
  body .toolbar{gap:8px 12px}
  body .tb-search,body .tb-search input{width:100%}
}
@media (max-width:720px){
  body .app,body .app.side-folded{grid-template-columns:minmax(0,1fr)}
  body aside{position:static;height:auto;flex-direction:row;flex-wrap:wrap;align-items:center;padding:8px 10px;border-right:0;border-bottom:1px solid var(--line)}
  body aside .sub,body aside .ft,body aside .lang,body aside .fold{display:none}
  body aside .logo{padding:0 10px 0 4px}
  body .bar h1{font-size:16px}
}
@media (prefers-reduced-motion:reduce){body *{transition:none !important}}

/* Tile tabs wrap onto several rows so every tab stays reachable */
body .tile .hd .tabs{flex-wrap:wrap;overflow:visible;row-gap:2px}
body .tile .hd .tabs button{margin-bottom:0}
button.lnk{border:0;background:none;padding:0;cursor:pointer;font:inherit;color:inherit}
