/* Palm Eye Cloud portal — Usage (pages/usage.js) and the live-page click heatmap overlay (heatmap.js), 2026-10-12.
 * Colour only through the theme variables, so light and dark follow styles.css / shell.css; geometry that depends on
 * data (bar heights, cell colours, ring fill) is set from JS through CSSOM, never a style attribute (the CSP forbids those).
 * Copyright © 2026 Palm Digitalz. All rights reserved. */

:root {
  --ux-bar: color-mix(in srgb, var(--blue) 46%, var(--surface2));
  --ux-bar-hi: color-mix(in srgb, var(--blue) 70%, var(--surface2));
  --ux-new: var(--teal);
  --ux-ret: var(--accent);
}

/* ---------- filters and KPIs ---------- */
.ux-filters { align-items: center; }
.ux-filters .ux-lab .select { min-width: 220px; max-width: 320px; }
.ux-lab { display: inline-flex; }
.ux-back { gap: 8px; text-decoration: none; height: 30px; }
.ux-back:hover { text-decoration: none; filter: brightness(1.08); }
.ux-kpis { margin-bottom: 0; }
.ux-kpi-sub { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.ux-kpi-x { color: var(--tertiary); flex-basis: 100%; }
.ux-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.ux-delta.up { color: var(--green); } .ux-delta.down { color: var(--red); } .ux-delta.flat { color: var(--secondary); }
.ux-delta span { font-size: 9px; vertical-align: 1px; }
.ux-flush > div > .empty, .ux-flush > div > .callout { margin: 0 var(--inset) var(--inset); }
.ux-flush .paged .tfoot { padding-left: var(--inset); padding-right: var(--inset); }
.ux-score-hint { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.ux-sub-h { font-size: 12px; font-weight: 600; color: var(--secondary); margin: 16px 0 6px; }
.ux-warn { color: var(--orange); font-weight: 600; }
.ux-tops { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ux-topnames { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); font-size: var(--t-subhead); vertical-align: middle; }
.ux-tops .pill { height: 22px; padding: 0 8px; font-weight: 500; }

/* ---------- daily activity: bars per day + the 7-day line ---------- */
.ux-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 4px; }
.ux-axis { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: var(--t-caption); color: var(--tertiary); text-align: right; font-variant-numeric: tabular-nums; line-height: 1; }
.ux-axis span:first-child { transform: translateY(-2px); } .ux-axis span:last-child { transform: translateY(2px); }
.ux-plot { position: relative; height: 200px; isolation: isolate; }
.ux-gridline { position: absolute; left: 0; right: 0; height: 1px; background: var(--hairline-soft); }
.ux-cols { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.ux-col { position: relative; height: 100%; border-radius: 3px; outline: none; }
.ux-col:hover, .ux-col:focus-visible { background: color-mix(in srgb, var(--label) 6%, transparent); }
.ux-col:focus-visible { box-shadow: 0 0 0 2px var(--accent) inset; }
.ux-bar { position: absolute; bottom: 0; left: 14%; right: 14%; border-radius: 3px 3px 0 0; background: var(--ux-bar); animation: uxGrow var(--dur-sheet) var(--ease) both; transform-origin: bottom; }
.ux-col:hover .ux-bar, .ux-col:focus-visible .ux-bar { background: var(--ux-bar-hi); }
.ux-bar-activeMin { background: color-mix(in srgb, var(--accent) 55%, var(--surface2)); }
.ux-bar-sessions { background: color-mix(in srgb, var(--purple) 50%, var(--surface2)); }
.ux-bar-logins { background: color-mix(in srgb, var(--green) 50%, var(--surface2)); }
.ux-line { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.ux-line polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ux-x { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.ux-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--ux-bar); }
.ux-sw.line { height: 2px; border-radius: 1px; background: var(--accent); }
.ux-sw.new { background: var(--ux-new); border-radius: 50%; } .ux-sw.ret { background: var(--ux-ret); border-radius: 50%; }
@keyframes uxGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- audience ---------- */
.ux-aud-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.ux-aud-n { font-size: 34px; font-weight: 300; letter-spacing: -.03em; line-height: 1; color: var(--label); font-variant-numeric: tabular-nums; }
.ux-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--track); gap: 2px; }
.ux-split i { display: block; min-width: 0; flex-basis: 0; }
.ux-split-new { background: var(--ux-new); } .ux-split-ret { background: var(--ux-ret); }

/* ---------- tables: clients and people ---------- */
.ux-org, .ux-person { white-space: nowrap; }
.ux-score { display: inline-flex; align-items: center; gap: 8px; cursor: help; }
.ux-score-n { font-weight: 600; min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.ux-ring { --p: 0; --c: var(--grey); width: 22px; height: 22px; border-radius: 50%; flex: none; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--track) 0); -webkit-mask: radial-gradient(circle, transparent 6px, #000 7px); mask: radial-gradient(circle, transparent 6px, #000 7px); }
.ux-ring.good { --c: var(--green); } .ux-ring.warn { --c: var(--yellow); } .ux-ring.orange { --c: var(--orange); } .ux-ring.bad { --c: var(--red); }
.ux-meter-wrap { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; }
.ux-meter { position: relative; display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; flex: none; }
.ux-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.ux-meter-t { font-size: var(--t-subhead); color: var(--secondary); font-variant-numeric: tabular-nums; }
.ux-spark { display: inline-block; width: 96px; height: 26px; vertical-align: middle; }
.ux-spark-none { font-size: 12px; }
.ux-status-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 var(--inset) 12px; font-size: 13px; color: var(--secondary); }
.ux-status { display: inline-flex; align-items: center; gap: 4px; cursor: help; }
.ux-screen { display: inline-flex; flex-direction: column; line-height: 1.25; }
.ux-screen .mono { font-size: var(--t-foot); }
.ux-err { color: var(--red); overflow-wrap: anywhere; white-space: normal; }
.ux-flame { width: 30px; padding: 0; color: var(--orange); }

/* ---------- one person ---------- */
.ux-user { border-color: color-mix(in srgb, var(--accent) 35%, var(--hairline-soft)); }
.ux-user-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.ux-avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--on-accent); background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--accent) 60%, #fff), var(--accent) 70%); }
.ux-user-name { font-size: 18px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ux-user-head .muted { font-size: 13px; overflow-wrap: anywhere; }
.ux-user-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr); gap: 24px; }
.ux-mini { display: flex; align-items: flex-end; gap: 2px; height: 90px; padding-top: 4px; border-bottom: 1px solid var(--hairline-soft); }
.ux-mini-b { flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--accent) 65%, var(--surface2)); }
.ux-mini-b.zero { background: var(--track); }
.ux-mini-b:hover { background: var(--accent); }
.ux-sessions { display: flex; flex-direction: column; gap: 8px; }
.ux-sess { border: 1px solid var(--hairline-soft); border-radius: var(--r-tile); background: var(--surface2); }
.ux-sess > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; cursor: pointer; font-size: var(--t-callout); }
.ux-sess > summary::-webkit-details-marker { display: none; }
.ux-sess > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--secondary); border-bottom: 1.6px solid var(--secondary); transform: rotate(-45deg); transition: transform .15s var(--ease); flex: none; }
.ux-sess[open] > summary::before { transform: rotate(45deg); }
.ux-sess-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.ux-sess-facts { color: var(--secondary); }
.ux-steps { list-style: none; margin: 0; padding: 0 14px 12px 34px; position: relative; }
.ux-steps::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 16px; width: 2px; background: var(--hairline); border-radius: 1px; }
.ux-step { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 6px 0; font-size: 13px; }
.ux-step::before { content: ""; position: absolute; left: -17px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface2); }
.ux-step-t { color: var(--tertiary); font-size: 12px; padding-top: 1px; }
.ux-step-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.ux-step-path { font-size: var(--t-foot); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.ux-step-facts { flex-basis: 100%; color: var(--secondary); font-size: var(--t-subhead); overflow-wrap: anywhere; }
.ux-step-err { flex-basis: 100%; color: var(--red); font-size: var(--t-foot); overflow-wrap: anywhere; }

/* ---------- retention ---------- */
.ux-ret { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: var(--t-subhead); font-variant-numeric: tabular-nums; }
.ux-ret th { font-weight: 600; color: var(--secondary); font-size: var(--t-foot); text-align: left; white-space: nowrap; padding: 2px 6px 2px 0; }
.ux-ret th.num, .ux-ret td.num { text-align: right; }
.ux-ret td { padding: 0 6px; height: 28px; white-space: nowrap; }
.ux-ret-c { text-align: center; border-radius: 6px; min-width: 40px; color: var(--label); background: var(--surface2); }
.ux-ret-c.hi { color: var(--on-accent); font-weight: 600; }
.ux-ret-c.future { background: none; border: 1px dashed var(--hairline-soft); }
.ux-ret-avg th { color: var(--label); }
.ux-ret-avg td { font-weight: 600; }

/* ---------- hours ---------- */
.ux-hours { display: grid; grid-template-columns: 34px repeat(24, minmax(12px, 1fr)); gap: 3px; min-width: 420px; }
.ux-hours-h { font-size: 10px; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.ux-hours-d { font-size: var(--t-foot); color: var(--secondary); align-self: center; }
.ux-hours-c { aspect-ratio: 1; min-height: 12px; border-radius: 3px; background: var(--surface2); outline: none; }
.ux-hours-c:hover, .ux-hours-c:focus-visible { box-shadow: 0 0 0 1.5px var(--label) inset; }

/* ---------- screen flow (Sankey) ---------- */
.ux-sk-wrap { overflow-x: auto; }
.ux-sk { display: block; width: 100%; min-width: 720px; height: auto; overflow: visible; }
.ux-sk-link { fill: none; stroke-opacity: .28; transition: stroke-opacity .15s; outline: none; }
.ux-sk-link:hover, .ux-sk-link:focus-visible { stroke-opacity: .6; }
.ux-sk-node { outline: none; cursor: default; }
.ux-sk-node:focus-visible { stroke: var(--label); stroke-width: 2; }
.ux-sk-label { font: 500 12px var(--font); fill: var(--label); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.ux-sk-step { font: 600 11px var(--font); fill: var(--tertiary); letter-spacing: .02em; text-transform: uppercase; }
.ux-flow-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.ux-flow-list ol { list-style: none; margin: 0; padding: 0; counter-reset: ux; }
.ux-flow-list li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--hairline-soft); font-size: 13px; }
.ux-flow-list li:last-child { border-bottom: 0; }
.ux-flow-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- click heatmap on the page's own shape ---------- */
.ux-heat-ctl .select { min-width: 240px; max-width: 360px; }
.ux-heat-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.ux-page { border: 1px solid var(--hairline); border-radius: var(--r-tile); overflow: hidden; background: var(--ground); box-shadow: 0 1px 0 var(--glass-top) inset; }
.ux-page-bar { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: var(--surface2); border-bottom: 1px solid var(--hairline-soft); font-size: var(--t-foot); color: var(--tertiary); }
.ux-page-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface3); flex: none; }
.ux-page-bar span { margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-page-scroll { max-height: 620px; overflow: auto; outline: none; }
.ux-page-scroll:focus-visible { box-shadow: 0 0 0 2px var(--accent) inset; }
.ux-page-sheet { position: relative; width: 100%; min-height: 320px;
  background:
    linear-gradient(var(--surface) 0 0) 4% 18px / 46% 26px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 64px, var(--hairline-soft) 64px 65px),
    linear-gradient(90deg, transparent 3%, color-mix(in srgb, var(--surface) 70%, transparent) 3% 97%, transparent 97%); }
.ux-page-canvas { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.ux-reach { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed color-mix(in srgb, var(--label) 35%, transparent); pointer-events: none; }
.ux-reach span { position: absolute; right: 8px; top: 2px; font-size: var(--t-caption); color: var(--secondary); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 1px 6px; border-radius: 6px; }
.ux-heat-side { min-width: 0; }
.ux-heat-stat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ux-els { list-style: none; margin: 0; padding: 0; }
.ux-els li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hairline-soft); font-size: 13px; }
.ux-els li:last-child { border-bottom: 0; }
.ux-els-l { display: flex; flex-direction: column; min-width: 0; }
.ux-els-l .strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-els-p { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-els-n { display: inline-flex; gap: 4px; align-items: center; flex: none; font-variant-numeric: tabular-nums; }
.ux-els-n .pill { height: 20px; padding: 0 6px; font-size: 11px; }
.ux-reach-bars { display: flex; flex-direction: column; gap: 4px; }
.ux-reach-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; align-items: center; font-size: var(--t-subhead); color: var(--secondary); }
.ux-reach-row .ux-meter { width: 100%; max-width: 160px; }

/* ---------- the live-page overlay (heatmap.js) ---------- */
.uxh-layer { position: absolute; z-index: 18; pointer-events: none; mix-blend-mode: normal; }
.uxh-canvas { display: block; opacity: .85; }
.uxh-panel { position: fixed; right: 16px; bottom: 16px; z-index: 66; width: min(340px, calc(100vw - 32px)); background: var(--surface); color: var(--label); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px 14px; font-size: 13px; animation: fade .15s var(--ease); }
.uxh-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.uxh-title { font-size: 12px; font-weight: 600; color: var(--secondary); }
.uxh-x { width: 30px; padding: 0; font-size: 18px; }
.uxh-route { margin-bottom: 6px; overflow-wrap: anywhere; }
.uxh-line { margin: 4px 0; font-size: var(--t-subhead); line-height: 1.4; }
.uxh-err { color: var(--red); }
.uxh-top { margin: 6px 0; padding-left: 18px; font-size: var(--t-subhead); }
.uxh-top li { padding: 1px 0; }
.uxh-top-l { display: inline-block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; margin-right: 6px; }
.uxh-legend { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; font-size: var(--t-foot); }
.uxh-ramp { flex: 1; height: 8px; border-radius: 4px; border: 1px solid var(--hairline-soft); }
.uxh-ctl { display: flex; flex-wrap: wrap; gap: 6px; }
.uxh-ctl .seg button { padding: 4px 8px; font-size: 12px; }

/* ---------- narrow screens (down to 375 px) ---------- */
@media (max-width: 1080px) {
  .ux-user-grid { grid-template-columns: 1fr 1fr; }
  .ux-heat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .ux-filters .seg { overflow-x: auto; max-width: 100%; }
  .ux-filters .ux-lab, .ux-filters .ux-lab .select, .ux-heat-ctl .ux-lab, .ux-heat-ctl .select { width: 100%; min-width: 0; max-width: none; flex: 1 1 100%; }
  .ux-axis, .ux-plot { height: 160px; }
  .ux-user-grid, .ux-flow-lists { grid-template-columns: 1fr; gap: 8px; }
  .ux-user-head { align-items: flex-start; }
  .ux-step { grid-template-columns: 1fr; gap: 0; }
  .ux-step-path { max-width: 160px; }
  .ux-page-scroll { max-height: 460px; }
  .uxh-panel { right: 8px; left: 8px; bottom: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ux-bar { animation: none; }
  .ux-sess > summary::before, .ux-sk-link { transition: none; }
}
