/* App720 analytics: consistent reading order, quiet surfaces, explicit entity colors.
   Loaded after legacy module styles. Keep data, status and entity cues separate. */
:root{
 --canvas:#f4f6fa;--paper:#fff;--ink:#26334a;--ink-strong:#17243b;
 --secondary:#52627a;--muted:#62718a;--line:#dce3ed;--soft:#f7f9fc;
 --ui-own:#405bd4;--ui-peer:#a45e21;--ui-own-wash:#f1f4ff;--ui-peer-wash:#fff8f0;
 --ui-table-head:#edf1f7;--ui-hover:#f3f6fb;--ui-selected:#e8edff;
 --ui-positive:#147650;--ui-negative:#b83248;
 --blue-strong:var(--ui-own);--green:var(--ui-positive);--red:var(--ui-negative);
}
body.dark{
 --canvas:#141d2c;--paper:#1c293d;--ink:#e0e7f4;--ink-strong:#f2f5fc;
 --secondary:#afbdd2;--muted:#9dacc3;--line:#36455e;--soft:#223148;
 --ui-own:#acbcff;--ui-peer:#f1bc83;--ui-own-wash:#273552;--ui-peer-wash:#362e2a;
 --ui-table-head:#25334a;--ui-hover:#2b3b54;--ui-selected:#34466b;
 --ui-positive:#88dfb7;--ui-negative:#ffabbb;
}
body{font-variant-numeric:tabular-nums lining-nums;-webkit-font-smoothing:antialiased}
.view-page{scroll-margin-top:90px}
.main-col{max-width:1600px!important}
body.kw5-mode .main-col{max-width:none!important}
/* Context scrolls away, leaving the chart and its own controls in view. */
body #contextBar,body.kw5-mode #contextBar{position:relative;top:auto}
#contextBar{gap:10px;padding-top:15px;padding-bottom:14px}
.ctx-app-field label,.ctx-field{font-size:11px;color:var(--secondary);line-height:1.4}
.ctx-footer{font-size:11px;color:var(--secondary)}
.ctx-path{font-size:11px}
.ctx-app-field select,.ctx-field select{font-size:13px;font-weight:650}
#psOpen{margin:0;align-self:center;white-space:nowrap;background:var(--paper);color:var(--ink);border-color:var(--line);font-size:12px}
.ov-head h2,.cat-page .cat-head h2,.ctx-scoped-head h2{font-size:26px;line-height:1.25;letter-spacing:-.55px;font-weight:750}
.ov-head p,.cat-head p,.ctx-scoped-head p{font-size:13px;line-height:1.6}
.ov-section-head h3,.cat-section-head h3,.section-heading h2{font-size:17px;font-weight:750}
/* Compact metrics read as one group, without adding dashboard windows. */
.ov-metrics{gap:0;padding:18px 0;grid-template-columns:repeat(3,minmax(0,280px))}
.ov-metrics>div{padding:0 22px;gap:6px}
.ov-metrics>div:first-child{padding-left:0}
.ov-metrics>div+div{border-left:1px solid var(--line)}
.ov-metrics>div>span{color:var(--secondary);font-size:12px}
.ov-metrics strong{font-size:25px;letter-spacing:-.5px}
.ov-metrics .up,.ov-change.up{color:var(--ui-positive)}
.ov-metrics .down,.ov-change.down{color:var(--ui-negative)}
.ov-metrics .ov-rating:first-child strong{color:var(--ui-own)}
.ov-metrics .ov-rating:nth-child(2) strong{color:var(--ui-peer)}
.ov-rating .app-identity{font-size:12px}
.ov-section{padding-top:24px;padding-bottom:18px}
.ov-note{font-size:12px;max-width:850px}
.ov-table-wrap{border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.ov-table thead th{background:var(--ui-table-head);font-size:12px;color:var(--secondary);padding:12px}
.ov-table th,.ov-table td{padding:14px 12px;font-size:13px}
.ov-table thead th:first-child,.ov-table tbody th{padding-left:12px}
.ov-table td.ov-position,.ov-table td.ov-peer{font-size:16px;font-weight:750}
.ov-table .ov-position{color:var(--ui-own)}
.ov-table .ov-peer{color:var(--ui-peer)}
.ov-table td.ov-position{background:transparent;border-left:1px solid var(--line);border-right:1px solid var(--line)}
.ov-table .ov-time{font-size:11px;line-height:1.55}
.ov-table th>small{font-size:11px;line-height:1.5}
.ov-table tbody tr:hover>:not(.ov-position){background:var(--ui-hover)}
.ov-table button{text-decoration:none;font-weight:650}
.ov-table button:hover{text-decoration:underline}
.ov-table th .app-identity{font-size:11px}
/* One low-contrast row treatment. Only the position column has a persistent tint. */
body.kw5-mode #kwWorkspace .kws-table thead th{background:var(--ui-table-head)!important;color:var(--secondary)!important;font-size:12px!important;line-height:1.45;border-bottom:1px solid var(--line)}
body.kw5-mode #kwWorkspace .kws-table tbody tr:nth-child(n) td{background:var(--paper)!important;color:var(--ink);border-bottom:1px solid var(--line);padding-top:13px;padding-bottom:13px}
body.kw5-mode #kwWorkspace .kws-table tbody tr:nth-child(n) td.kws-col-rank{background:var(--paper)!important;border-left:1px solid var(--line);border-right:1px solid var(--line)}
body.kw5-mode #kwWorkspace .kws-table tbody tr:hover td{background:var(--ui-hover)!important}
body.kw5-mode #kwWorkspace .kws-table tbody tr.selected td{background:var(--ui-selected)!important}
body.kw5-mode #kwWorkspace .kws-table tbody tr.selected td:first-child{box-shadow:inset 3px 0 var(--ui-own)!important}
body.kw5-mode #kwWorkspace .kws-table .kws-keyword{color:var(--ink-strong);font-size:14px;font-weight:650;line-height:1.4}
body.kw5-mode #kwWorkspace .kw6-bars{display:none}
body.kw5-mode #kwWorkspace .kws-table .kws-col-signal small,
body.kw5-mode #kwWorkspace .kws-table .kws-col-updated small{font-size:11px;line-height:1.5;color:var(--secondary)}
body.kw5-mode #kwWorkspace .kws-table .kws-col-signal .kws-signal{color:var(--ink-strong);font-size:14px}
body.kw5-mode #kwWorkspace .kws-table .kws-col-competitor strong{color:var(--ui-peer);font-size:15px}
body.kw5-mode #kwWorkspace .kws-rank-band:is(.top3,.top10,.lower){background:transparent!important;color:var(--ui-own)!important;font-weight:750;font-size:18px!important;border-radius:0;box-shadow:none}
.kws-origin,.kws-rank-status{font-size:11px;color:var(--secondary)}
body.kw5-mode #kwWorkspace .kws-table .kws-col-change .kws-delta{font-size:13px}
body.kw5-mode #kwWorkspace .mv4-actions button{min-width:32px;min-height:36px;color:var(--secondary)}
body.kw5-mode #kwWorkspace .kws-foot{font-size:12px;color:var(--secondary);padding-top:12px}
body.kw5-mode #kwWorkspace .kws-disclaimer{background:var(--soft);color:var(--secondary);border-color:var(--line);font-size:11px;line-height:1.75}
body.kw5-mode #kwWorkspace .kw5-toolbar-actions button{background:var(--paper);color:var(--secondary);border:1px solid var(--line)}
body.kw5-mode #kwWorkspace .kw5-toolbar-actions #kwsAdd{background:#405bd4!important;color:#fff!important;border-color:#405bd4!important}
body.kw5-mode #kwWorkspace .kws-controls{padding-top:10px;padding-bottom:14px}
.kw7-view button[aria-pressed=true]{background:var(--ui-own-wash);color:var(--ui-own);box-shadow:inset 0 0 0 1px var(--line)}
.kw7-coverage{color:var(--secondary)}
/* Graphs: one entity palette, clear axes, consistent solid/dashed series. */
.cat-page{--cat-accent:var(--ui-own);--cat-peer:var(--ui-peer);--cat-muted:var(--secondary);--cat-positive:var(--ui-positive);--cat-negative:var(--ui-negative)}
.rvc{--rvc-primary:var(--ui-own);--rvc-peer:var(--ui-peer)}
.cat-page .cat-kpis{margin-top:16px;margin-bottom:20px}
.cat-page .cat-kpi{min-width:0;gap:8px}
.cat-page .cat-kpi strong{font-weight:750;line-height:1.3;overflow-wrap:anywhere}
.cat-page .cat-kpi span{font-size:12px}
.cat-page .cat-kpi small{font-size:11px;line-height:1.6}
.cat-page .cat-section-head{padding:18px 20px 12px}
.cat-page #catPlot{padding:0 12px 6px}
.cat-page .cat-axis{color:var(--secondary)}
.cat-page .cat-axis text{font-family:inherit;font-size:12px}
.cat-series-primary :is(line,circle){stroke:var(--ui-own)}
.cat-series-peer :is(line,circle){stroke:var(--ui-peer)}
.cat-series-primary circle{fill:var(--ui-own);stroke:var(--paper)}
.cat-series-peer circle{fill:var(--ui-peer);stroke:var(--paper)}
.cat-svg :is(line,polyline),.kw7-plot :is(line,polyline){vector-effect:non-scaling-stroke}
.cat-page .cat-chart-legend,.kw7-legend{font-size:12px;line-height:1.6;gap:10px 22px}
.cat-page .cat-chart-legend .cat-legend-primary,.kw7-own{color:var(--ui-own)}
.cat-page .cat-chart-legend .cat-legend-peer,.kw7-peer{color:var(--ui-peer)}
.cat-chart-legend .cat-legend-primary i{background:var(--ui-own)}
.cat-chart-legend .cat-legend-peer i{border-color:var(--ui-peer)}
.kw7-line{stroke:var(--ui-own)}
.kw7-line.is-peer{stroke:var(--ui-peer)}
.kw7-line circle{fill:var(--ui-own)}
.kw7-line.is-peer circle{fill:var(--ui-peer)}
.kw7-plot text{font-size:12px;fill:var(--secondary)}
.kw7-plot svg{color:var(--secondary)}
.cat-hover-tooltip{border-color:var(--line);box-shadow:0 8px 28px #14243b26}
.cat-page .cat-table thead th,.ctx-table-wrap th,.rvh-table-scroll thead th{background:var(--ui-table-head);color:var(--secondary);font-size:12px}
.cat-page .cat-table td{border-bottom-color:var(--line)}
.cat-page .cat-source-details>summary{font-size:12px;min-height:36px}
.cat-page .cat-graph-foot{color:var(--secondary);line-height:1.6}
.cat-page .cat-filters{margin-bottom:10px}
/* Responsive charts use a real narrow coordinate system, not scaled-down desktop text. */
@media(max-width:650px){
 .top-actions{gap:7px}#psOpen{font-size:11px;padding:7px 9px;min-height:36px}
 .top-date{display:none}.top-actions .small-divider{display:none}
 body #contextBar{position:relative;top:auto;padding:12px;gap:9px}
 .ctx-fields{gap:10px}.ctx-app-field label,.ctx-field{font-size:11px}
 .ctx-footer{font-size:10px;line-height:1.6}
 .ov-head h2,.cat-page .cat-head h2{font-size:23px}
 .ov-head p,.cat-head p{font-size:12px}
 .ov-metrics{gap:14px 0;padding:16px 0;grid-template-columns:repeat(2,minmax(0,1fr))}
 .ov-metrics>div{padding:0 12px}.ov-metrics>div:nth-child(3){border-left:0;border-top:1px solid var(--line);padding:14px 0 0}
 .ov-metrics .ov-rating{grid-column:auto}.ov-metrics strong{font-size:24px}
 .ov-rating .app-identity-name{font-size:11px}
 .ov-section{padding:18px 0}.ov-section-head{align-items:flex-start;gap:10px}
 .ov-section-head h3{font-size:16px;line-height:1.45}.ov-section-head a{min-height:30px;white-space:nowrap;font-size:11px}
 .ov-table th,.ov-table td{padding:12px 7px;font-size:12px}
 .ov-table thead th:first-child,.ov-table tbody th{padding-left:7px;width:37%}
 .ov-table thead th{font-size:11px}.ov-table td.ov-position,.ov-table td.ov-peer{font-size:15px}
 .ov-table th>small{font-size:10px}.ov-table .app-identity-icon{width:20px;height:20px;min-width:20px}
 body.kw5-mode #kwWorkspace .kws-table .kws-keyword{font-size:12px}
 body.kw5-mode #kwWorkspace .kws-table .kws-col-rank .kws-rank-band{font-size:16px!important;min-width:40px}
 body.kw5-mode #kwWorkspace .kws-table tbody tr:nth-child(n) td{padding-top:12px;padding-bottom:12px}
 body.kw5-mode #kwWorkspace .kws-col-rank .kws-rank-status{font-size:10px;line-height:1.45}
 .cat-page .cat-kpi span{font-size:11px}.cat-page .cat-kpi small{font-size:11px}
 .cat-page .cat-kpi strong{font-size:22px}
 .cat-page #catPlot{padding:0 6px 6px}.cat-page .cat-axis text,.kw7-plot text{font-size:12px}
 .kw7-plot{padding:0 4px}.cat-page .cat-chart-legend small{line-height:1.6}
 .kw7-legend{padding:0 12px;gap:8px 14px}.kw7-hover{line-height:1.7}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Secondary workspaces use the same type scale and neutral metric treatment. */
.ars-intro h2,.ls-head h1{font-size:26px;line-height:1.25;font-weight:750;letter-spacing:-.55px}
.ars-intro p,.ars-source-note,.ars-kpi small,.ars-table-bottom,.ars-method p{color:var(--secondary);font-size:12px;line-height:1.65}
.ars-table th{background:var(--ui-table-head);color:var(--secondary);font-size:12px;font-weight:650}
.ars-table td,.ars-kw strong{font-size:13px}
.ars-kw small,.ars-table td small,.ars-signal-value small,.ars-na,.ars-app-name small,.ars-idea small{font-size:11px;color:var(--secondary);line-height:1.55}
.ars-rank{color:var(--ui-own);font-size:16px}
.ars-proxy,.ars-volume,.ars-signal-value strong,.ars-signal-proxy strong{color:var(--ink-strong)}
.ars-kpi span{font-size:12px;color:var(--secondary)}
.ars-kpi b{font-size:25px;letter-spacing:-.5px;font-weight:750}
.ars-search input,.ars-sort-label select,.ars-targets select{font-size:12px;min-height:38px}
.ars-app-name strong,.ars-idea b{font-size:12px;font-weight:650}
.ars-section-head h3{font-size:15px}
.ars-table tbody tr:hover{background:var(--ui-hover)}
.ars-table tbody tr.selected{background:var(--ui-selected)}
.rvc-section{--rvc-primary:var(--ui-own);--rvc-peer:var(--ui-peer)}
.rvc-table-scroll thead th,.ls-panel table th,.ha-table thead th{background:var(--ui-table-head);color:var(--secondary);font-size:12px;line-height:1.5}
.rvc-table-scroll td,.rvh-table-scroll td,.ls-panel table td{font-size:12px;line-height:1.6}
.rvc-axis,.rvh-grid-label{font-size:11px}
.rvh-rating{font-size:26px;font-weight:750;color:var(--ui-own)}
.rvh-app-card.peer .rvh-rating{color:var(--ui-peer)}
.rvh-app-top strong{font-size:13px;font-weight:650}
.rvh-app-top span,.rvh-meta span,.rvh-details,.rvh-cell small{font-size:11px}
.rvc-section-title h3,.ls-panel>h3{font-size:17px;font-weight:750}
body.kw5-mode #kwWorkspace .kws-table-shell{max-height:72vh;max-height:72dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
body.kw5-mode #kwWorkspace .kws-table thead th{position:sticky;top:0;z-index:5}
body.dark.kw5-mode #kwWorkspace .kws-table thead th{background:var(--ui-table-head)!important;color:var(--secondary)!important}
body.dark.kw5-mode #kwWorkspace .kws-table tbody tr:nth-child(n) td{background:var(--paper)!important;color:var(--ink)}
body.dark.kw5-mode #kwWorkspace .kws-table tbody tr:nth-child(n) td.kws-col-rank{background:var(--paper)!important}
body.dark.kw5-mode #kwWorkspace .kws-table tbody tr:hover td{background:var(--ui-hover)!important}
body.dark.kw5-mode #kwWorkspace .kws-table tbody tr.selected td{background:var(--ui-selected)!important}
@media(max-width:1100px){.ars-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:650px){
 .ars-intro h2,.ls-head h1{font-size:23px}
 .ars-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
 .ars-table td,.ars-kw strong{font-size:12px}
 .ars-table-wrap,.cat-table-holder,.rvh-table-scroll{overscroll-behavior:contain}
 .rvc-legend>span{max-width:100%}
 .rvh-app-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .rvh-app-top strong{font-size:12px;overflow-wrap:anywhere}
 .rvh-app-card{padding:12px 10px}.rvh-rating{font-size:24px}
}
/* Second visual pass: no light legacy panels in dark mode. */
body.dark.kw5-mode #kwWorkspace .kw5-toolbar,
body.dark.kw5-mode #kwWorkspace .kws-controls,
body.dark.kw5-mode #kwWorkspace .kw5-toolbar-actions,
body.dark.kw5-mode #kwWorkspace .kw5-quicktools{background:var(--paper)!important;border-color:var(--line);color:var(--ink)}
body.dark.kw5-mode #kwWorkspace .kw5-toolbar :is(button,label),
body.dark.kw5-mode #kwWorkspace .kws-controls :is(label,.kws-pills>span),
body.dark.kw5-mode #kwWorkspace .ux-quick{color:var(--secondary)}
body.dark.kw5-mode #kwWorkspace :is(.kws-search,.kws-pills,.kw5-group-slot select){background:var(--soft)!important;border-color:var(--line)!important;color:var(--ink)!important}
body.dark.kw5-mode #kwWorkspace :is(.kws-controls select,.kws-search input,.ux-quick button){background:var(--paper);color:var(--ink);border-color:var(--line)}
body.dark.kw5-mode #kwWorkspace .kws-pills button{background:var(--paper);color:var(--secondary);border-color:var(--line)}
body.dark.kw5-mode #kwWorkspace .kws-pills button[aria-pressed=true],
body.dark.kw5-mode #kwWorkspace .ux-quick button[aria-pressed=true]{background:var(--ui-own-wash);color:var(--ui-own);border-color:var(--ui-own)}
body.dark.kw5-mode #kwWorkspace .kw5-toolbar-actions button{background:var(--soft)!important;color:var(--ink)!important;border-color:var(--line)!important}
body.dark .ars-source-note{background:var(--soft);color:var(--secondary);border-color:var(--line)}
@media(max-width:650px){
 .ov-table thead .app-identity{display:inline-flex;flex-direction:column;align-items:flex-start;gap:4px;font-size:10px}
 .ov-table thead .app-identity-name{display:block;font-size:10px;line-height:1.3}
 .ov-table .rank-not-found{font-size:11px!important;white-space:nowrap}
 .ov-table thead th:first-child,.ov-table tbody th{width:34%}
}
@media(max-width:650px){.top-actions #themeBtn{display:inline-flex!important;align-items:center;justify-content:center;flex:none;width:32px;height:34px}}
body.kw5-mode #kwWorkspace .kws-table .kws-col-change .kws-delta.up{color:var(--ui-positive)}
body.kw5-mode #kwWorkspace .kws-table .kws-col-change .kws-delta.down{color:var(--ui-negative)}
body.kw5-mode #kwWorkspace .kws-table .kws-col-change .kws-delta:is(.same,.none){color:var(--secondary)}
/* The common header already contains the page path. Keep context for filters/errors. */
#contextBar .ctx-path{display:none}
#contextBar .ctx-top:has(#ctxStatus[hidden]){display:none}
@media(max-width:650px){body.kw5-mode .topbar .top-actions{display:flex!important;gap:7px;margin-left:auto}}
/* Reviews have their own contextual heading and controls, like other workspaces. */
body[data-page=reviews] :is(.page-heading,.scope-bar){display:none!important}
body[data-page=reviews] .rv-head{margin-top:4px;margin-bottom:18px}
.ars-source-details,.rv-source-details{margin:0 0 16px;color:var(--secondary);font-size:12px;line-height:1.6}
.ars-source-details>summary,.rv-source-details>summary{cursor:pointer;min-height:36px;padding:8px 0;font-weight:650;outline-offset:3px}
.ars-source-details .ars-source-note{margin:8px 0 0}
.rv-source-details .rv-source{margin:8px 0 0}
.ars-source-details>summary:focus-visible,.rv-source-details>summary:focus-visible{outline:3px solid #92a1fb}
body.dark.kw5-mode #kwWorkspace #mv4NewGroup{background:var(--soft);color:var(--ui-own);border-color:var(--line)}
.ld-editor .ld-primary{background:#405bd4;color:#fff}

/* Exact rank badges: entity color stays stable; fill strength indicates the tier. */
.ui-rank{
 --rank-color:var(--ui-rank-own,#354ebc);--rank-fill:5%;
 --rank-bg:color-mix(in srgb,var(--rank-color) var(--rank-fill),var(--paper));
 display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;
 min-width:36px;min-height:30px;padding:5px 8px;box-sizing:border-box;
 border:1px solid transparent;border-radius:7px;background:var(--rank-bg);
 color:var(--rank-color);font-size:16px;font-weight:750;line-height:1;
 font-variant-numeric:tabular-nums;white-space:nowrap;text-decoration:none;
}
.ui-rank-top3{--rank-fill:17%}
.ui-rank-top10{--rank-fill:10%}
.ui-rank-peer{--rank-color:var(--ui-rank-peer,#884a16)}
.ui-rank-neutral{--rank-color:var(--secondary);--rank-fill:4%}
body.kw5-mode #kwWorkspace .kws-rank-band.ui-rank{
 background:var(--rank-bg)!important;color:var(--rank-color)!important;
 min-width:36px;min-height:30px;padding:5px 8px!important;border-radius:7px;
 font-size:16px!important;line-height:1;box-shadow:none;
}
body.kw5-mode #kwWorkspace .kws-col-competitor .ui-rank{color:var(--rank-color);font-size:16px}
.cat-page .cat-kpi .ui-rank{font-size:22px;min-height:36px;padding:6px 10px}
.kws-detail-rank .ui-rank{font-size:24px;min-height:40px;padding:7px 12px}
.ov-table .ui-rank{font-size:16px}
.cat-roster-table .ui-rank{font-size:14px;min-width:32px;min-height:28px;padding:5px 6px}
@media(max-width:650px){
 .ui-rank,.ov-table .ui-rank{min-width:32px;min-height:28px;font-size:15px;padding:5px 7px}
 body.kw5-mode #kwWorkspace .kws-col-rank .kws-rank-band.ui-rank{min-width:32px;padding:5px 6px!important;font-size:15px!important}
 body.kw5-mode #kwWorkspace .kws-col-competitor .ui-rank{font-size:15px}
}

body.dark{--ui-rank-own:var(--ui-own);--ui-rank-peer:var(--ui-peer)}
