/* FILE-MAP:
purpose: Styles for the Radar de Estoque dashboard, identity "Varredura"
  (variant A, approved 2026-08-30). All colors/type/radius come from
  tokens.css; this file only composes them into components: topbar, five
  view tabs, global cut row (filter triggers + cut chip + fallback notice),
  insight cards (severity as border + text tag) with severity toggles
  ("Mostrar:" label + check-box chips, distinct from the semaphore badges),
  KPI cards with bullet benchmarks, 7d delta pills (or the muted .dnote
  line inside a CD cut) and "Ver SKUs" actions,
  distribution, semaphore strip, DC-chart and Estoque-por-CD rows as
  buttons, ranklists, customizable table (sticky selection + SKU columns,
  fixed layout with colgroup widths and resize handles, photo thumbnails,
  Depósitos pills, target-price warning cell), filter triggers + the
  anchored multi-select panel (.fpop*, bottom sheet at <=640px), filter
  chips, popovers, "i" tooltips (.tip + #tipbox), floating selection bar,
  Grupos tab, Tendências legend + delta table, Glossário tab, skeletons.
depends_on:
  - path: ./tokens.css
    uses: [all tokens]
used_by:
  - path: ./index.html
    uses: [all classes]
touches:
  db_tables: []
  env: []
  config_files: []
  cache_keys: []
effects: []
invariants:
  - no horizontal scroll on the page body at 375px or 1280px (the table
    scrolls inside .tbl-scroll only, which is position: relative so sr-only
    text inside cells cannot widen the page; first column stays sticky)
  - icons are inline SVGs, never typographic glyphs (no "+", "‹", "›" as icons)
  - interactive targets >= 44px on touch-relevant controls
  - dark and light themes both driven purely by tokens.css variables
  - [hidden] always wins over component display rules
  - severity/status is never conveyed by color alone (text tag or label beside it)
category: frontend-style
END-FILE-MAP */

* { box-sizing: border-box; }
/* the hidden attribute must win over any display rule (flex/grid bars toggled via .hidden) */
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  transition: background var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
main { max-width: 1280px; margin: 0 auto; padding: 8px clamp(12px, 3vw, 28px) 48px; }
h1, h2 { font-family: var(--font-head); }
button { font-family: var(--font-body); }
.num, .tnum { font-family: var(--font-num); font-feature-settings: "tnum"; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  max-width: 1280px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 28px) 10px;
}
@media (max-width: 640px) {
  .topbar { padding-top: 10px; padding-bottom: 4px; gap: 8px; }
  .logo { width: 32px; height: 32px; }
  .scope-row { margin-top: 6px; }
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-dim); color: var(--accent); flex: none;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.sub { margin: 1px 0 0; color: var(--mut); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.lbl { color: var(--mut); font-size: 12px; }

select, input[type="search"] {
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 9px 11px; font-size: 13px; font-family: inherit;
  min-height: 40px;
  transition: border-color var(--t-fast) var(--ease);
}
select:hover, input[type="search"]:hover { border-color: var(--line-strong); }
select:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-input); display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); color: var(--mut); cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-strong); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  border-radius: var(--r-input); padding: 9px 15px; cursor: pointer; border: 1px solid transparent;
  min-height: 40px;
  transition: all var(--t-fast) var(--ease);
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-strong); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.busy { pointer-events: none; opacity: .65; }

/* verify badge */
.vbadge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  color: var(--ok); background: var(--ok-dim); border-radius: 999px; padding: 2px 9px; cursor: help;
}
.vbadge.fail { color: var(--warn); background: var(--warn-dim); }

/* ---------- scope row ---------- */
.scope-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-top: 10px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-chip); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--mut); font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 7px; cursor: pointer; min-height: 38px;
  transition: all var(--t-fast) var(--ease);
}
.seg button[aria-checked="true"] { background: var(--accent-dim); color: var(--accent-ink); }
.seg button:hover[aria-checked="false"] { color: var(--fg); }

/* global cut: label + two filter triggers + summary chip + clear */
.cut-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cut-lbl { text-transform: uppercase; letter-spacing: .7px; font-size: 11px; font-weight: 600; }
.chip.cut { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-dim); padding: 3px 13px; gap: 6px; }
.chip.cut .chip-main { cursor: default; gap: 6px; }
.chip.cut svg { flex: none; }
.cut-controls .kpi-act { margin: 0; padding: 6px 4px; min-height: 40px; }
.cut-notice {
  margin: 10px 0 0; padding: 8px 12px; font-size: 13px; color: var(--fg);
  background: var(--warn-dim); border: 1px solid var(--warn); border-radius: 8px;
}
.scope-note { margin: 8px 0 0; }
.scope-note:empty { display: none; }
/* KPI "note" (e.g. "consolidado do escopo") and side-by-side medians */
.kpi .hint .note { font-style: italic; }
.kpi-multi { font-size: 21px; letter-spacing: -.3px; }
/* severity toggles above the insight cards */
.ins-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.ins-head .ins-h { margin: 0; }
/* the chips are toggles, not data (they must not look like the semaphore
   badges): a visible "Mostrar:" label, a check box that fills when on and
   stays an empty muted outline when off */
.sev-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sev-lbl { font-size: 11.5px; font-weight: 600; color: var(--mut); margin-right: 2px; }
.chip.sev { cursor: pointer; padding: 6px 12px 6px 8px; min-height: 36px; gap: 6px; color: var(--mut); font-size: 11.5px; background: transparent; border-style: dashed; }
.chip.sev .sev-box { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid currentColor; opacity: .6; flex: none; }
.chip.sev .sev-box svg { width: 10px; height: 10px; }
.chip.sev.on { color: var(--fg); border-style: solid; background: var(--card); }
.chip.sev.on .sev-box { opacity: 1; background: currentColor; }
.chip.sev.on .sev-box svg { color: var(--card); }
.chip.sev.on.sev-crit { border-color: var(--crit); color: var(--crit); }
.chip.sev.on.sev-warn { border-color: var(--warn); color: var(--warn); }
.chip.sev.on.sev-info { border-color: var(--info); color: var(--info); }
.chip.sev.on.sev-good { border-color: var(--ok); color: var(--ok); }
.chip.sev:hover { border-color: var(--line-strong); }
.ins-note { font-style: italic; }
/* semaphore strip: counts of the cut, each badge is a button */
.sem-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 10px; }
.sem-strip .sem-btn { cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; min-height: 36px; padding: 6px 11px; display: inline-flex; align-items: center; gap: 5px; }
.sem-strip .sem-btn b { font-feature-settings: "tnum"; }
.sem-strip .sem-btn:hover { filter: brightness(1.12); }
/* Estoque por CD: rows toggle the CD in the cut. `.bars.wh-bars` outranks the
   generic `.bars .bar-row` (64px 1fr 44px) declared later in this file; the
   value column fits its text so the card never pushes the page sideways */
.bars.wh-bars .bar-row { grid-template-columns: 72px minmax(80px, 1fr) auto; }
.wh-bars .wh-name { text-align: left; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.wh-bars .wh-fill { background: var(--accent); }
.wh-bars .wh-meta { font-weight: 500; color: var(--mut); text-align: right; white-space: nowrap; }
.wh-bars .wh-row.on { background: var(--accent-dim); border-color: var(--accent); }
.wh-bars .wh-row.on .wh-name { color: var(--accent-ink); }
.wh-bars .wh-note { margin: 8px 0 0; }
.wh-bars .wh-empty { margin: 6px 0 0; }
/* text-only action ("mostrar 4 CDs vazios"): looks like a link, is a button */
.linkbtn { background: none; border: 0; padding: 2px 0; font: inherit; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; border-radius: 4px; }
.linkbtn:hover { color: var(--fg); }
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wh-bars .wh-fallback { margin: 10px 0 0; }
@media (max-width: 640px) {
  .bars.wh-bars .bar-row { grid-template-columns: 60px 1fr; }
  .wh-bars .wh-meta { grid-column: 2; text-align: left; white-space: normal; }
}
/* Depósitos pills (table column + drawer) */
.whp { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; color: var(--mut); white-space: nowrap; }
.whp b { color: var(--fg); font-feature-settings: "tnum"; }
.whp.zero { opacity: .65; }
.whp.zero b { color: var(--mut); }
.dwh { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.dist .dist-total { margin: 6px 0 0; }
.dist .dist-total b { color: var(--fg); }

/* "Como ler este painel": link-styled button that opens the Glossário tab */
.howto-link {
  cursor: pointer; color: var(--mut); font: inherit; font-size: 12.5px;
  padding: 9px 12px; min-height: 40px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-input);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.howto-link:hover { color: var(--fg); border-color: var(--line-strong); }

/* ---------- tooltips ("i" buttons) ---------- */
.tip {
  display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 5px; padding: 0;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--mut);
  cursor: help; vertical-align: middle; flex: none;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tip:hover, .tip[aria-expanded="true"], .tip:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
/* touch: a 24px hit area around the 16px dot (the resize handle stays above it);
   24px is the most that fits next to the "?" (.hq) without the two targets crossing */
.tip { position: relative; }
.tip::before { content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); }
th .tip { margin-left: 2px; text-transform: none; letter-spacing: 0; }
/* in the header the hit area grows only vertically: sideways it would sit
   on top of the neighbour cell's resize handle */
th .tip::before { width: 16px; }
.kpi .label .tip, .dfield dt .tip { text-transform: none; letter-spacing: 0; }
.card h2 .tip, .ins-h .tip { margin-left: 2px; }
.tipbox {
  position: fixed; z-index: 70; width: max-content; max-width: 340px; padding: 10px 12px;
  background: var(--elevated); color: var(--fg); border: 1px solid var(--line-strong); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.45;
}
.tipbox .tip-l { display: block; font-family: var(--font-head); font-size: 13px; margin-bottom: 4px; }
.tipbox p { margin: 0; }
.tipbox .tip-h { margin-top: 5px; color: var(--mut); }
.tipbox .tip-e { margin-top: 5px; color: var(--mut); font-style: italic; }

/* ---------- Glossário tab ---------- */
.glossary-search { display: inline-flex; flex: 1 1 220px; max-width: 360px; }
.glossary-search input { width: 100%; }
.gl-intro { margin: 0 0 10px; }
.gl-group { margin-top: 18px; }
.gl-group h3 { margin: 0 0 6px; font-family: var(--font-head); font-size: 14px; color: var(--accent-ink); }
.gl-group h3 .meta { font-weight: 400; }
.gl-list { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
.gl-item { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.gl-item dt { font-weight: 600; font-size: 13.5px; }
.gl-item dd { margin: 3px 0 0; font-size: 13px; }
.gl-item dd p { margin: 0; overflow-wrap: anywhere; }
.gl-item .gl-how { color: var(--mut); margin-top: 3px; }
.gl-item .gl-ex { color: var(--mut); font-style: italic; margin-top: 3px; }
.gl-empty { padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-card); }

/* ---------- insights ("Ações do dia") ---------- */
.insights { margin-top: 14px; }
.ins-h { margin: 0 0 8px; font-size: 13px; color: var(--mut); font-weight: 600; letter-spacing: .2px; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.ins {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 12px 14px 10px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  border-left: 4px solid var(--info);
}
.ins-crit { border-left-color: var(--crit); }
.ins-warn { border-left-color: var(--warn); }
.ins-info { border-left-color: var(--info); }
.ins-good { border-left-color: var(--ok); }
/* severity is never color alone: the tag spells it out */
.ins-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; color: var(--info); }
.ins-crit .ins-tag { color: var(--crit); }
.ins-warn .ins-tag { color: var(--warn); }
.ins-good .ins-tag { color: var(--ok); }
.ins-value { font-family: var(--font-num); font-feature-settings: "tnum"; font-size: 24px; font-weight: 700; letter-spacing: -.4px; line-height: 1.1; }
.ins-title { margin: 0; font-family: var(--font-head); font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.ins-detail { margin: 0; font-size: 12px; color: var(--mut); line-height: 1.45; }
.ins .ins-act { margin-top: auto; align-self: flex-start; }
.ins-more { margin-top: 10px; }
.ins-more summary {
  cursor: pointer; color: var(--mut); font-size: 12.5px; font-weight: 600; list-style: none;
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 4px; border-radius: var(--r-input);
}
.ins-more summary::-webkit-details-marker { display: none; }
/* disclosure icon: chevron-down closed, chevron-up open (inline SVGs in the markup) */
.ins-more summary svg { margin-right: 6px; flex: none; }
.ins-more summary .ic-open, .ins-more[open] summary .ic-closed { display: none; }
.ins-more[open] summary .ic-open { display: inline; }
.ins-more summary:hover { color: var(--fg); }
.ins-more[open] summary { margin-bottom: 10px; }
.ins-empty { margin: 0; padding: 12px 14px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-card); }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 14px 16px; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--sweep); opacity: .8; }
.kpi .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--mut); font-weight: 600; }
.kpi .value { font-family: var(--font-num); font-feature-settings: "tnum"; font-size: 25px; font-weight: 700; letter-spacing: -.4px; margin-top: 5px; }
.kpi .hint { font-size: 11.5px; color: var(--mut); margin-top: 6px; }
.kpi .hint .delta { font-weight: 700; }
.kpi .hint .delta.good { color: var(--ok); }
.kpi .hint .delta.bad { color: var(--crit); }
.kpi .hint .delta.neutral { color: var(--mut); }
.bullet { height: 6px; border-radius: 4px; background: var(--line); position: relative; margin-top: 10px; }
.bullet .fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); min-width: 2px; transition: width var(--t-med) var(--ease); }
.bullet .fill.warn { background: var(--warn); }
.bullet .fill.crit { background: var(--crit); }
.bullet .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .65; border-radius: 2px; }
.bscale { display: flex; justify-content: space-between; font-size: 10px; color: var(--mut); margin-top: 4px; font-feature-settings: "tnum"; }
/* "Ver SKUs": quiet text button at the foot of the card, full-height target */
.kpi-acts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; }
.kpi-act, .btn-sm {
  display: inline-flex; align-items: center; gap: 3px; background: none; border: 0; cursor: pointer;
  color: var(--accent-ink); font: inherit; font-size: 12px; font-weight: 600;
  padding: 8px 4px 8px 0; margin: -4px 0; min-height: 36px; border-radius: var(--r-input);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color var(--t-fast) var(--ease);
}
.kpi-act:hover, .kpi-act:focus-visible { text-decoration-color: currentColor; }
.kpi-act svg { opacity: .7; }

/* ---------- distribution real x expected ---------- */
.dist .drow { display: grid; grid-template-columns: 56px minmax(80px, 1fr) auto; gap: 10px; align-items: center; margin: 10px 0; }
.dist .dl { font-family: var(--font-head); font-weight: 600; font-size: 13px; }
/* count + share + manual reference stay on one line; "Ver SKUs" on its own line, right-aligned */
.dist .dmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 11.5px; color: var(--mut); text-align: right; font-feature-settings: "tnum"; }
.dist .dpair { white-space: nowrap; }
/* rows are buttons (open the table filtered by curve): full-width, quiet chrome */
.dist .drow-btn {
  width: 100%; background: none; border: 1px solid transparent; border-radius: var(--r-input);
  color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 6px 8px; margin: 2px -8px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.dist .drow-btn:hover { background: var(--surface); border-color: var(--line); }
.dist .dbar { display: block; }
.dist .dgo { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-ink); font-weight: 600; }
@media (max-width: 640px) { .dist .drow { grid-template-columns: 40px 1fr; } .dist .dmeta { grid-column: 2; align-items: flex-start; text-align: left; } }

/* ---------- cards / charts / lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 13px; color: var(--mut); font-weight: 600; letter-spacing: .2px; display: flex; align-items: center; gap: 7px; }
.card.center { text-align: center; max-width: 420px; margin: 15vh auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 > * { min-width: 0; } /* grid items default to min-width:auto; ranklist min-content would force body overflow at 375 */
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.h2-ic { display: inline-grid; place-items: center; }
.h2-ic svg { display: block; }
.up-ic { color: var(--crit); }
.down-ic { color: var(--info); }

.bars .bar-row { display: grid; grid-template-columns: 64px 1fr 44px; gap: 8px; align-items: center; margin: 8px 0; }
.bars .bar-label { color: var(--mut); font-size: 12px; text-align: right; font-feature-settings: "tnum"; }
.bars .bar-track { display: block; background: var(--surface); border-radius: 5px; height: 14px; overflow: hidden; }
.bars .bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--crit); min-width: 2px; transition: width var(--t-med) var(--ease); }
.bars .bar-n { font-size: 12px; font-weight: 700; font-feature-settings: "tnum"; }
/* bars are buttons (open the critical SKUs of that coverage bucket) */
.bars .bar-btn {
  width: 100%; background: none; border: 1px solid transparent; border-radius: var(--r-input);
  color: inherit; font: inherit; cursor: pointer; padding: 6px 8px; margin: 2px -8px; min-height: 36px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.bars .bar-btn:hover { background: var(--surface); border-color: var(--line); }
.bars .bar-btn:hover .bar-n, .bars .bar-btn:focus-visible .bar-n { color: var(--accent-ink); }
.rk-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.meta { color: var(--mut); font-size: 12px; }

.ranklist { list-style: none; margin: 0; padding: 0; }
.ranklist li {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.ranklist li:last-child { border-bottom: 0; }
.ranklist .nm { flex: 1 1 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranklist .meta { font-size: 12px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--line); color: var(--mut);
}
.badge.s1 { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }
.badge.s2 { color: var(--warn); border-color: var(--warn); background: var(--warn-dim); }
.badge.s3 { color: var(--ok); border-color: var(--ok); background: var(--ok-dim); }
.badge.s4 { color: var(--info); border-color: var(--info); background: var(--info-dim); }
.badge.z-verde_urgente, .badge.z-verde { color: var(--accent-ink); border-color: var(--ok); background: var(--ok-dim); }
.badge.z-amarela { color: var(--warn); border-color: var(--warn); background: var(--warn-dim); }
.badge.z-laranja { color: var(--orange); border-color: var(--orange); background: var(--orange-dim); }
.badge.z-vermelha { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }

/* provisioned purchases: "a caminho" badge next to the status + overdue text */
.badge.po {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  margin-left: 6px; color: var(--info); border-color: var(--info); background: var(--info-dim);
  font-variant-numeric: tabular-nums;
}
.badge.po svg { flex: none; }
.badge.po.po-late { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }
td.late, .late { color: var(--crit); font-weight: 600; }

/* drawer flag with critical severity (overdue provisioned purchase) */
.badge.flag-crit { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }

/* on-demand refresh: visible status line + spinning icon while the cycle runs */
.refresh-status {
  margin: 10px 0 0; padding: 8px 12px; font-size: 13px; color: var(--fg);
  background: var(--info-dim); border: 1px solid var(--line); border-radius: 8px;
}
#refresh-btn.busy svg { animation: refresh-spin 1.2s linear infinite; }
#refresh-btn:disabled { opacity: 0.65; cursor: default; }
@keyframes refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #refresh-btn.busy svg { animation: none; } }

/* ---------- table section ---------- */
.tbl-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tbl-head h2 { margin: 0; }
.tbl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.filters input[type="search"] { flex: 1 1 200px; }

/* dimension filter buttons (open the multi-select popover) */
.fbtn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--mut); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-input);
  transition: all var(--t-fast) var(--ease);
}
.fbtn:hover { color: var(--fg); border-color: var(--line-strong); }
.fbtn.on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-dim); }
.fbtn .fchev { display: inline-flex; opacity: .6; margin-left: auto; }
/* trigger text: muted placeholder ("Todas as marcas") vs. selected value(s) */
.fbtn .fph { color: var(--mut); font-weight: 500; }
.fbtn .fval { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbtn.on .fval { color: var(--accent-ink); }

/* anchored multi-select panel (positioned by app.js under its trigger;
   non-modal, so no overlay; scoped to .fpop so .col-list stays untouched) */
.fpop {
  position: fixed; z-index: 45; width: min(340px, calc(100vw - 24px)); max-height: 420px;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--elevated); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
}
.fpop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 14px 6px; }
.fpop-head b { font-family: var(--font-head); font-size: 14px; }
/* option count ("8 de 42") + selection state; the dot only shows between two texts */
.fpop-meta { display: flex; gap: 6px; white-space: nowrap; }
.fpop-meta #fpop-count:not(:empty)::after { content: "·"; margin-left: 6px; }
.fpop-search {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--elevated);
}
.fpop-search-ic { display: inline-flex; color: var(--mut); flex-shrink: 0; }
.fpop-search input {
  flex: 1; min-width: 0; min-height: 36px; padding: 6px 0; border: 0; border-radius: 0;
  background: transparent; color: var(--fg); font: inherit; font-size: 13px; outline: 0;
}
.fpop-search input::placeholder { color: var(--mut); } /* --dim fails AA on --elevated */
.fpop-search:focus-within { border-bottom-color: var(--accent); }
.fpop-list { list-style: none; margin: 0; padding: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.fpop-list li { padding: 0; }
.fpop-list label {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 8px;
  border-radius: var(--r-input); font-size: 13px; cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.fpop-list label:hover { background: var(--card); }
.fpop-list label:has(:checked) { color: var(--fg); }
.fpop-list input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.fpop-list input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fpop-loading { color: var(--mut); font-size: 12.5px; padding: 10px 8px; list-style: none; }
.fpop-empty { padding: 14px; text-align: center; color: var(--mut); font-size: 12.5px; }
.fpop-foot { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.fpop-foot .btn { min-height: 36px; padding: 6px 12px; }
@media (max-width: 640px) {
  /* bottom sheet: app.js clears the inline anchor styles below this width */
  .fpop { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 70vh; }
  .fpop-list label { min-height: 44px; }
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 12px; align-items: center; min-height: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600;
  color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 6px 3px 13px; min-height: 34px;
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--line-strong); }
/* real buttons inside the chip (keyboard-operable; no nested role=button) */
.chip .chip-main {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  color: inherit; font: inherit; cursor: pointer; padding: 6px 2px; border-radius: 999px;
}
.chip .x {
  display: inline-grid; place-items: center; background: none; border: 0; cursor: pointer;
  color: inherit; opacity: .7; padding: 14px; margin: -11px -7px -11px -7px; border-radius: 999px;
}
.chip .x:hover { opacity: 1; }
.chip.preset.on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-dim); }
.chip.applied { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-dim); }
.chip.applied .chip-main { cursor: default; }
button.chip { cursor: pointer; padding: 7px 13px; gap: 6px; }
button.chip.save { color: var(--mut); border-style: dashed; }
button.chip.save:hover { color: var(--accent); border-color: var(--accent); }
.chips-label { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .7px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* position: relative keeps absolutely positioned descendants (the .sr-only
   "sem dado" text next to every dash) inside the scroller instead of
   widening the page */
.tbl-scroll { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-chip); }
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; font-size: 12.5px; }
/* v5: fixed layout driven by the <colgroup> app.js builds (widths per column,
   `name` takes the leftover); cells clip with an ellipsis instead of growing */
#sku-table, #g-table { table-layout: fixed; min-width: 0; }
#sku-table td, #g-table td { overflow: hidden; text-overflow: ellipsis; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* resize handle on the right edge of each header cell (>= 40px tall target,
   9px wide hit area, visible line on hover/focus/drag) */
th { overflow: visible; }
.col-resize {
  position: absolute; top: 0; bottom: 0; right: 0; width: 9px; z-index: 5;
  cursor: col-resize; touch-action: none; user-select: none;
}
.col-resize::after {
  content: ""; position: absolute; top: 8px; bottom: 8px; right: 1px; width: 2px; border-radius: 2px;
  background: var(--line-strong); opacity: .3; transition: opacity var(--t-fast) var(--ease);
}
th:hover .col-resize::after, .col-resize:focus-visible::after, th.resizing .col-resize::after { opacity: 1; }
.col-resize:focus-visible { outline: 0; }
.col-resize:focus-visible::after, th.resizing .col-resize::after { background: var(--accent); }
th.resizing { background: var(--accent-dim); }
/* touch: a 9px invisible strip with touch-action none hijacks horizontal
   swipes over the header; widths stay at their defaults there */
@media (pointer: coarse) { .col-resize { display: none; } }
th {
  color: var(--mut); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
/* sortable header: real button filling the cell (>=40px target) */
th { padding: 0 4px; }
.th-wrap { display: inline-flex; align-items: center; gap: 0; }
/* numeric headers keep the same order as text headers (grip, label, info tip): the
   th text-align already pushes the wrap to the right, so the tip always sits last */
th.num .th-wrap { justify-content: flex-end; }
.th-label { padding: 12px 7px; display: inline-block; }
.th-sort {
  display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
  padding: 12px 7px; min-height: 40px; border-radius: var(--r-input);
  transition: color var(--t-fast) var(--ease);
}
.th-sort:hover { color: var(--fg); }
.th-sort.on { color: var(--accent-ink); }
.th-sort .sort-ic { display: inline-flex; opacity: .55; }
.th-sort.on .sort-ic { opacity: 1; }
.col-grip {
  display: inline-flex; align-items: center; justify-content: center; background: none; border: 0;
  padding: 12px 3px; cursor: grab; color: var(--dim); border-radius: var(--r-input);
  opacity: .35; transition: opacity var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
th:hover .col-grip, th:focus-within .col-grip { opacity: 1; }
.col-grip:hover { color: var(--mut); }
.col-grip:active { cursor: grabbing; }
/* no hover on touch: header DnD off below 768px, the column manager covers reorder */
@media (max-width: 767px) { .col-grip { display: none; } }
th.dragging { opacity: .45; }
th.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
th.drop-after { box-shadow: inset -2px 0 0 var(--accent); }
th.sticky-1.drop-before, th.sticky-1.drop-after { box-shadow: 1px 0 0 var(--line); }
/* compact density: tighter rows; header buttons keep their >=40px target */
.tbl-scroll[data-density="compact"] td { padding: 5px 9px; font-size: 11.5px; }
.tbl-scroll[data-density="compact"] .th-sort, .tbl-scroll[data-density="compact"] .th-label, .tbl-scroll[data-density="compact"] .col-grip { padding-top: 10px; padding-bottom: 10px; }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover td { background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.c-name { overflow: hidden; text-overflow: ellipsis; }
td.c-k { font-family: var(--font-num); font-size: 11.5px; font-feature-settings: "tnum"; }
/* photo thumbnail: fixed 36px box; grey placeholder when there is no photo
   or the URL fails (the img-err flag set by onerror swaps them) */
td.c-img { width: 48px; padding-top: 4px; padding-bottom: 4px; }
.c-img img, .c-img .img-ph, .dphoto img, .dphoto .img-ph {
  display: block; object-fit: cover; border-radius: 6px; background: var(--surface); border: 1px solid var(--line);
}
.c-img img, .c-img .img-ph { width: 36px; height: 36px; }
/* placeholder shows alone (no URL) or after a failed img (img-err on the parent) */
.c-img img + .img-ph, .dphoto img + .img-ph { display: none; }
.c-img.img-err img, .dphoto.img-err img { display: none; }
.c-img.img-err img + .img-ph, .dphoto.img-err img + .img-ph { display: block; }
.tbl-scroll[data-density="compact"] .c-img img, .tbl-scroll[data-density="compact"] .c-img .img-ph { width: 28px; height: 28px; }
/* target buy price when the current cost already breaks the margin */
td.warn-cell { color: var(--warn); font-weight: 600; box-shadow: inset 3px 0 0 var(--warn); }
.warn-text { color: var(--warn); font-weight: 600; }
.warn-text small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
th.sticky-1, td.sticky-1 { position: sticky; left: 0; z-index: 3; background: var(--card); box-shadow: 1px 0 0 var(--line); }
th.sticky-1 { z-index: 4; background: var(--surface); }
tbody tr:hover td.sticky-1 { background: var(--surface); }

/* selection column: always first, sticky; the SKU column shifts right of it */
th.c-sel, td.c-sel { width: 40px; min-width: 40px; padding: 0 8px; text-align: center; }
.c-sel input[type="checkbox"] { width: 18px; height: 18px; margin: 0; vertical-align: middle; accent-color: var(--accent); cursor: pointer; }
th.c-sel input[type="checkbox"] { margin: 11px 0; }
th.sticky-0, td.sticky-0 { position: sticky; left: 0; z-index: 3; background: var(--card); }
th.sticky-0 { z-index: 4; background: var(--surface); }
tbody tr:hover td.sticky-0 { background: var(--surface); }
table.has-sel th.sticky-1, table.has-sel td.sticky-1 { left: 40px; }
.empty-row { text-align: center; color: var(--mut); padding: 24px 10px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.pager .btn { gap: 4px; }
.pager .btn svg { flex: none; }
#pg-info { color: var(--mut); font-size: 12.5px; font-feature-settings: "tnum"; }
.pg-size-wrap { display: inline-flex; align-items: center; gap: 7px; }
#pg-size { padding: 8px 10px; font-size: 12px; }
.seg-sm button { padding: 7px 12px; font-size: 11.5px; }
.foot { color: var(--mut); font-size: 11.5px; text-align: center; margin-top: 22px; }
.empty { padding: 0 16px; }

/* ---------- column manager popover ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4, 6, 8, .5); z-index: 40; }
.popover {
  position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(400px, 92vw); max-height: 80vh; overflow: auto;
  background: var(--elevated); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop); padding: 16px;
}
.pop-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.pop-head b { font-family: var(--font-head); font-size: 15px; }
.pop-state { font-size: 11.5px; color: var(--mut); }
.col-list { list-style: none; margin: 0; padding: 0; }
.col-list li {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.col-list li:last-child { border-bottom: 0; }
.col-list label { flex: 1; display: flex; align-items: center; gap: 9px; cursor: pointer; min-height: 40px; }
.col-list input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.col-list .locked { color: var(--mut); font-size: 11px; }
.col-move { display: flex; gap: 4px; }
.col-move button {
  width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line);
  background: transparent; color: var(--mut); cursor: pointer; display: grid; place-items: center;
  transition: all var(--t-fast) var(--ease);
}
.col-move button:hover:not(:disabled) { color: var(--fg); border-color: var(--line-strong); }
.col-move button:disabled { opacity: .3; cursor: default; }
.pop-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
/* name dialog: "save the columns too" option (views only) */
.savepop-opt { display: flex; align-items: center; gap: 9px; min-height: 40px; margin-top: 10px; font-size: 13px; cursor: pointer; }
.savepop-opt input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* preset chip that also restores the column layout */
.chip .chip-cols { display: inline-flex; color: var(--mut); }

/* ---------- date picker (APG date picker dialog) ---------- */
#date-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 9px 12px; font: inherit; font-size: 13px;
  cursor: pointer; transition: border-color var(--t-fast) var(--ease);
}
#date-btn:hover { border-color: var(--line-strong); }
#datepop { width: min(360px, 92vw); }
#datepop-shortcuts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#datepop-shortcuts button {
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
  border-radius: var(--r-chip); padding: 8px 12px; font: inherit; font-size: 12px;
  min-height: 40px; cursor: pointer; transition: border-color var(--t-fast) var(--ease);
}
@media (max-width: 640px) { #datepop-shortcuts button { min-height: 44px; } }
#datepop-shortcuts button:hover:not([aria-disabled="true"]) { border-color: var(--line-strong); }
#datepop-shortcuts button[aria-disabled="true"] { color: var(--dim); opacity: .6; cursor: default; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
#cal-month { font-family: var(--font-head); font-size: 13.5px; font-weight: 600; }
#cal-month::first-letter { text-transform: uppercase; } /* "Agosto de 2026", not "Agosto De 2026" */
#cal-prev[aria-disabled="true"], #cal-next[aria-disabled="true"] { opacity: .35; cursor: default; }
#cal-grid { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; } /* escape the global table min-width meant for the SKU table */
#cal-grid th { font-size: 10.5px; font-weight: 600; color: var(--mut); padding: 6px 0; text-transform: lowercase; }
#cal-grid td { padding: 1px; }
#cal-grid td button {
  position: relative; width: 100%; min-height: 44px; border: 1px solid transparent;
  background: transparent; color: var(--fg); border-radius: var(--r-input);
  font-family: var(--font-num); font-feature-settings: "tnum"; font-size: 13px;
  cursor: pointer; display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
/* available day: full-contrast number + a solid 4px dot (presence mark, not
   color-only); today: outline; selected: filled — distinguishable in grayscale */
#cal-grid td button.has-data::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 999px; background: var(--accent);
}
#cal-grid td button.has-data:hover { border-color: var(--line-strong); background: var(--surface); }
/* today = neutral outline (>=3:1), selected = accent 2px border + fill —
   distinct from each other and from plain days even in grayscale */
#cal-grid td button[aria-current="date"] { border-color: var(--mut); }
#cal-grid td button[aria-selected="true"] { background: var(--accent-dim); color: var(--accent-ink); border: 2px solid var(--accent); }
#cal-grid td button[aria-selected="true"].has-data::after { background: var(--accent-ink); }
/* no opacity: --dim at full strength keeps the grid frame readable (>=3:1);
   the missing dot is what marks the day as unavailable */
#cal-grid td button[aria-disabled="true"] { color: var(--dim); cursor: not-allowed; }
/* light --dim sits right at 3:1 over --elevated; --mut clears it with margin
   while the missing dot still separates unavailable from available days */
[data-theme="light"] #cal-grid td button[aria-disabled="true"] { color: var(--mut); }
#cal-grid td.cal-empty { min-height: 42px; }
#datepop-note { margin-top: 8px; }

/* ---------- view tabs + Tendências ---------- */
.view-tabs { display: flex; gap: 4px; padding: 0 16px; max-width: 1280px; margin: 0 auto 14px; border-bottom: 1px solid var(--line); }
.view-tabs [role="tab"] {
  background: none; border: 0; cursor: pointer; color: var(--mut);
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 11px 16px; min-height: 44px;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  transition: color var(--t-fast) var(--ease);
}
.view-tabs [role="tab"]:hover { color: var(--fg); }
/* five tabs at 375px: tighter padding, and the tablist scrolls inside itself
   (never the page body) if a translation ever makes them wider */
.view-tabs { overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 640px) {
  .view-tabs { padding: 0 8px; gap: 0; }
  .view-tabs [role="tab"] { padding: 11px 7px; font-size: 12.5px; white-space: nowrap; }
}
.view-tabs [role="tab"][aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tchart { width: 100%; max-width: 720px; display: block; }
/* 7-day delta pills on the KPI value line (same palette as the trend deltas) */
.kpi-delta { display: inline-flex; vertical-align: middle; margin-left: 6px; }
/* inside a CD cut the 7d pill gives way to a plain muted line under the value */
.kpi-delta:has(.dnote) { display: block; margin: 2px 0 0; }
.dnote { font-family: var(--font-body); font-size: 11.5px; font-weight: 500; letter-spacing: 0; color: var(--mut); }
.dpill {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0; font-family: var(--font-num); font-feature-settings: "tnum";
  border: 1px solid var(--line); color: var(--mut); background: var(--surface); cursor: help; white-space: nowrap;
}
.dpill.good { color: var(--ok); border-color: var(--ok); background: var(--ok-dim); }
.dpill.bad { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }
.dpill.neutral { font-weight: 600; }
/* Tendências: legend under the chart + atual vs. anterior table */
.tlegend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--mut); }
/* current-period band under the chart: a 7% accent wash vanished over
   --surface, so it gets a visible fill plus a hairline edge in both themes */
.tband { fill: var(--accent); fill-opacity: .16; stroke: var(--accent); stroke-opacity: .55; stroke-width: 1; }
[data-theme="light"] .tband { fill-opacity: .12; stroke-opacity: .5; }
/* one availability note above the trend cards (replaces the per-card hint) */
.trend-compare { margin: 12px 0 -4px; }
.tl { display: inline-flex; align-items: center; gap: 6px; }
.tl-line { display: inline-block; width: 22px; height: 0; border-top: 2.4px solid var(--c, var(--accent)); }
.tl-line.dashed { border-top-style: dashed; border-top-width: 2px; }
.tl-line.dotted { border-top-style: dotted; border-top-width: 2.4px; }
.tl-band { display: inline-block; width: 14px; height: 12px; border-radius: 3px; background: var(--accent); opacity: .18; margin-left: -4px; }
.tdeltas-scroll { border: 0; }
table.tdeltas { min-width: 520px; }
table.tdeltas th[scope="row"] { position: static; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--fg); font-weight: 600; padding: 9px 11px; }
table.tdeltas thead th { padding: 9px 11px; }
table.tdeltas thead th .meta { text-transform: none; letter-spacing: 0; font-weight: 500; }
table.tdeltas td.prior { color: var(--mut); }
table.tdeltas .delta-cell { font-weight: 700; font-family: var(--font-num); font-feature-settings: "tnum"; }
table.tdeltas .delta-cell.good { color: var(--ok); background: var(--ok-dim); }
table.tdeltas .delta-cell.bad { color: var(--crit); background: var(--crit-dim); }
table.tdeltas .delta-cell.neutral { color: var(--mut); }
#trend-chart-note { margin-top: 8px; }
#trend-note { font-feature-settings: "tnum"; }
table.movers { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 620px; font-size: 12.5px; }
.mv-expand {
  background: none; border: 0; cursor: pointer; color: var(--fg); font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 4px; margin: -8px 0; border-radius: var(--r-input);
  font-family: var(--font-num); font-feature-settings: "tnum";
}
.mv-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
tr.mv-child td { background: var(--surface); }
tr.mv-child td:first-child { padding-left: 34px; }
.minibar.mv { display: inline-flex; align-items: flex-end; gap: 2px; height: 28px; }
.minibar.mv .mb { width: 6px; }
#savepop-name { width: 100%; margin: 4px 0 6px; }
/* what the view being saved contains (filters summary) */
.savepop-summary { margin: 0 0 4px; overflow-wrap: anywhere; }

/* ---------- SKU detail drawer ---------- */
.c-k .k-open {
  background: none; border: 0; padding: 10px 2px; margin: -10px 0; cursor: pointer;
  color: var(--accent-ink); font: inherit; font-family: var(--font-num); font-feature-settings: "tnum";
  border-radius: var(--r-input); text-decoration: underline; text-decoration-color: transparent;
  transition: text-decoration-color var(--t-fast) var(--ease);
}
.c-k .k-open:hover, .c-k .k-open:focus-visible { text-decoration-color: currentColor; }
tbody tr:has(.k-open) { cursor: pointer; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(440px, 94vw); overflow-y: auto; padding: 18px 22px;
  background: var(--elevated); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform var(--t-med) var(--ease);
}
.drawer.in { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.drawer-head h2 { margin: 0; font-size: 17px; font-family: var(--font-num); font-feature-settings: "tnum"; }
.drawer-sub { margin: 3px 0 0; color: var(--mut); font-size: 12.5px; }
.dphoto { margin: 0 0 12px; }
.dphoto img, .dphoto .img-ph { width: 100%; max-width: 240px; height: auto; aspect-ratio: 1; }
.dphoto.none .img-ph { max-width: 120px; }
.dbadges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dbadges .flag { color: var(--info); border-color: var(--info); background: var(--info-dim); }
/* higher specificity on purpose: ties with .dbadges .flag would lose by source order */
.dbadges .flag.flag-crit { color: var(--crit); border-color: var(--crit); background: var(--crit-dim); }
.dlist { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 16px; }
.dfield { display: flex; flex-direction: column; gap: 2px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.dfield dt { color: var(--mut); font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.dfield dd { margin: 0; font-size: 14px; font-family: var(--font-num); font-feature-settings: "tnum"; }
#drawer-hist h3 { font-size: 13px; margin: 4px 0 10px; }
#drawer-hist h3 .meta { font-weight: 400; }
.hblock { margin-bottom: 16px; }
.hhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.minibar { display: flex; align-items: flex-end; gap: 3px; height: 46px; }
.mb-wrap { flex: 1 1 0; max-width: 26px; display: flex; align-items: flex-end; height: 100%; }
.mb { width: 100%; background: var(--accent); opacity: .75; border-radius: 2px 2px 0 0; min-height: 3px; }
.minibar-scale { display: flex; justify-content: space-between; color: var(--dim); font-size: 10.5px; margin-top: 3px; font-feature-settings: "tnum"; }

@media (max-width: 640px) {
  .drawer {
    top: auto; left: 0; right: 0; width: 100%; max-height: 84vh;
    border-left: 0; border-top: 1px solid var(--line); border-radius: var(--r-card) var(--r-card) 0 0;
    transform: translateY(100%); padding-top: 24px;
  }
  .drawer::before {
    content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong);
  }
  .dlist { grid-template-columns: 1fr 1fr; }
  #drawer-close { min-width: 44px; min-height: 44px; }
  /* the 7-button period seg (386px) overflows the 375px viewport if kept on one line */
  #trends .seg { flex-wrap: wrap; }
}

/* ---------- selection bar (bulk action, NN/g: persistent, near the bottom) ---------- */
.selbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 35;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  max-width: calc(100vw - 24px); padding: 10px 14px;
  background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--r-card); box-shadow: var(--shadow-pop);
}
.selbar-n { font-weight: 600; font-feature-settings: "tnum"; margin-right: 4px; }
.selbar .btn { min-height: 38px; padding: 7px 13px; }
.selbar .kpi-act { margin: 0; padding: 6px 4px; min-height: 38px; }
@media (max-width: 640px) {
  /* full-width sheet: a shrink-wrapped bar stacks the buttons in a 180px column */
  .selbar { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; padding: 8px 10px; }
  .selbar-n { flex-basis: 100%; text-align: center; margin: 0; }
  .selbar .btn, .selbar .kpi-act { min-height: 44px; }
}

/* ---------- Grupos tab ---------- */
.gflags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip.gflag { cursor: pointer; padding: 7px 13px; color: var(--mut); }
.chip.gflag:hover { color: var(--fg); }
.chip.gflag.on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-dim); }
.g-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.glist { list-style: none; margin: 0; padding: 0; }
.glist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.glist li:last-child { border-bottom: 0; }
.glist li.on .g-open { color: var(--accent-ink); }
.glist .g-none { padding: 8px 2px; }
.glist .g-open {
  flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; text-align: left;
  background: none; border: 0; cursor: pointer; color: var(--fg); font: inherit; padding: 9px 6px; min-height: 44px; border-radius: var(--r-input);
}
.glist .g-open:hover { background: var(--surface); }
.glist .g-open b { font-weight: 600; }
.g-tools { display: flex; gap: 4px; flex: none; }
.icon-btn.sm { width: 36px; height: 36px; }
.g-empty { margin: 14px 2px 0; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-card); }
.g-head { align-items: flex-start; margin-top: 14px; }
.g-head .g-title { font-size: 16px; color: var(--fg); margin: 0; }
.g-head p { margin: 2px 0 0; }
.g-sem { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.g-sem .badge b { font-feature-settings: "tnum"; }
.kpi-err .value { color: var(--mut); }

/* ---------- skeleton loading ---------- */
.skel { position: relative; overflow: hidden; background: var(--surface); border-radius: 6px; color: transparent !important; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }

/* ranklists: the product name opens the SKU drawer (same rows as the table) */
.ranklist .rk-open {
  background: none; border: 0; padding: 4px 0; margin: -4px 0; min-height: 24px; font: inherit; color: inherit;
  text-align: left; cursor: pointer; text-decoration: underline dotted transparent; text-underline-offset: 3px;
}
@media (max-width: 640px) { .ranklist .rk-open { min-height: 28px; padding-block: 6px; margin: -4px 0; } }
.ranklist .rk-open:hover, .ranklist .rk-open:focus-visible { text-decoration-color: currentColor; }
.card-sub { margin: -6px 0 10px; font-size: 12px; color: var(--mut); }

/* ---------- "Como usar" tab (cards + wiki) ---------- */
.howto-intro h2 { margin-bottom: 4px; }
.howto-lead { margin: 0; max-width: 760px; }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.howto-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0; outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.howto-card:focus-visible, .howto-card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.howto-card h3 { margin: 0; font-family: var(--font-head); font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.howto-card h3 .num { color: var(--mut); font-size: 12px; font-weight: 600; }
.howto-card > .meta { margin: 0; flex: 1; }
.howto-poster {
  position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r-input);
  overflow: hidden; background: var(--bg); cursor: pointer; aspect-ratio: 16 / 10;
}
.howto-poster img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.howto-poster.tall img { object-fit: contain; }
.howto-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(10, 13, 18, .72); color: #fff; border: 1px solid rgba(255, 255, 255, .35);
  transition: transform var(--t-fast) var(--ease);
}
.howto-poster:hover .howto-play, .howto-poster:focus-visible .howto-play { transform: translate(-50%, -50%) scale(1.08); }
.howto-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 999px; background: rgba(10, 13, 18, .78); color: #fff; font: 600 11px/1.6 var(--font-num); }
.howto-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.howto-acts .btn { padding: 7px 12px; min-height: 36px; font-size: 12.5px; text-decoration: none; }
.btn .ext { margin-left: -2px; opacity: .8; }
.howto-more { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
.howto-more li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.howto-more li b { font-weight: 600; }
.howto-more li .meta { flex: 1 1 200px; }
.howto-more li .kpi-act { margin-left: auto; }
a.kpi-act { text-decoration: none; }
.gl-item .kpi-act { margin-top: 4px; }
/* video dialog; .tall = the phone case (375x812): narrow dialog, no letterbox */
.vidpop { width: min(960px, 94vw); padding: 12px; }
.vidpop video { display: block; width: 100%; max-height: 70vh; background: #000; border-radius: var(--r-input); }
.vidpop.tall { width: min(420px, 94vw); }
.vidpop.tall video { width: auto; max-width: 100%; max-height: 78vh; margin-inline: auto; }
/* phone: the 1280px videos are unreadable there, so the live tour becomes the
   primary action of the card and "Assistir" the secondary one */
.howto-acts .act-live { display: none; }
@media (max-width: 640px) {
  .howto-acts .act-live { display: inline-flex; order: -1; background: var(--accent); color: var(--on-accent); border-color: transparent; }
  /* the poster button already plays the clip; a third text button only forced a
     second row of actions (UX round 3: card 392px -> ~350px at 375) */
  .howto-acts .act-watch { display: none; }
  .howto-acts .btn { flex: 1 1 0; justify-content: center; }
}
/* touch: 44px targets (NN/g / WCAG 2.5.5) for the semaphore strip, the card
   actions and the welcome dialog buttons; mouse keeps the 36px density */
@media (pointer: coarse) {
  .sem-strip .sem-btn, .howto-acts .btn, .welcome .pop-foot .btn, .welcome .icon-btn { min-height: 44px; }
  .welcome .icon-btn { min-width: 44px; }
}
.vidpop .pop-foot { margin-top: 10px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.vidpop .btn { text-decoration: none; }
@media (max-width: 640px) { .howto-grid { grid-template-columns: 1fr; } .vidpop { width: 96vw; padding: 8px; } }

/* ---------- first-visit welcome + checklist + "?" help links ---------- */
/* flex column with a sticky footer: title and "Pular"/"Fazer o tour" stay
   visible together at 1280x800 and 375x812; the body scrolls in between */
.welcome { --wp: 16px; width: min(560px, 94vw); max-height: 92vh; padding: var(--wp); display: flex; flex-direction: column; }
.welcome > * { flex: none; }
.welcome .pop-foot { position: sticky; bottom: 0; margin: auto 0 calc(-1 * var(--wp)); padding: 10px 0 var(--wp); background: var(--elevated); }
.welcome-lead { margin: 0 0 10px; }
.welcome-poster { margin: 0 0 12px; }
@media (max-height: 860px) { .welcome-poster { aspect-ratio: 16 / 7; } }
.welcome .hp-title { margin: 0 0 6px; }
.welcome-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.welcome-steps li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-input); font-size: 13.5px; min-width: 0; }
.welcome-steps li.done { border-color: var(--ok); }
.welcome-steps .wstep-t { display: flex; flex-direction: column; min-width: 0; }
.welcome-steps .wstep-t .meta { font-size: 12px; }
.welcome-steps li.done .wstep-t { color: var(--mut); }
/* step circle: the number of the step; a check on green once it is done (never a checkbox) */
.wstep-box { width: 20px; height: 20px; border-radius: 999px; border: 1px solid var(--line-strong); display: grid; place-items: center; flex: none; color: var(--mut); font: 600 11px/1 var(--font-num); }
.welcome-steps li.done .wstep-box { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.howto-progress { margin-top: 12px; }
.howto-progress .hp-title, .welcome .hp-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--mut); letter-spacing: .2px; text-transform: uppercase; }
.howto-progress .welcome-steps { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
/* three actions in the welcome footer: "Pular" left, the tour (primary) and the videos right; wraps on phones */
.welcome .pop-foot { flex-wrap: wrap; }
.welcome .pop-foot #welcome-videos { margin-left: auto; }
@media (max-width: 420px) { .welcome .pop-foot #welcome-start { flex: 1 1 100%; justify-content: center; order: -1; } .welcome .pop-foot #welcome-videos { margin-left: 0; } }
/* "Refazer o tour" under the checklist of "Como usar" */
.hp-acts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
/* 12px after the "i": the two 24px hit areas sit side by side without crossing */
.hq {
  position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 12px; flex: none;
  border-radius: 999px; border: 1px solid var(--line-strong); color: var(--mut); text-decoration: none; vertical-align: middle;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.hq:hover, .hq:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
.hq::before { content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); }
.card h2 .hq, .ins-h .hq, .cut-lbl .hq { text-transform: none; letter-spacing: 0; }
@media (max-width: 640px) { .welcome { --wp: 12px; width: 96vw; } }
