/* ═══ STATS (Ian 2026-09-14): design B, the Inventory chrome, with C's additions ═══
   The toolbar carries the title and the view switcher, styled like Inventory's Cards/List seg.
   The filters sit on their own row under it, like Inventory's Filters row. The Overview opens
   with a hero number, four question boxes and a This week strip; the picked stat boxes and
   the charts follow unchanged. Label rows carry a profit-on-cost bar. */

/* ---- toolbar: title · view tabs · actions ---- */
#view-metrics .toolbar{margin-bottom:8px;align-items:center}
#view-metrics .toolbar .section-title{font-size:15px;letter-spacing:0;text-transform:none;font-family:inherit}
#metricViewSeg{display:inline-flex;background:var(--panel);border:1px solid var(--line2);border-radius:12px;padding:3px;gap:2px;overflow:visible;flex-wrap:wrap}
#metricViewSeg button{background:transparent;border:0;border-radius:9px;padding:8px 13px;min-height:44px;font-size:13px;font-weight:700;color:var(--muted);display:flex;flex-direction:column;align-items:flex-start;gap:1px;line-height:1.15}
#metricViewSeg button.active{background:var(--panel2);color:var(--txt)}
#metricViewSeg button:hover{color:var(--txt)}
#metricViewSeg button.locked{opacity:.55}
#metricViewSeg button.locked small{font-size:9.5px;font-weight:600;letter-spacing:.02em;color:var(--muted);text-transform:none}
#metricViewSeg button:not(.locked) small{display:none}
body.ianui #metricViewSeg{display:inline-flex}   /* the dropdown that replaced it is retired */
#iuMetricViewSel,#iuMetricViewLbl{display:none!important}
#view-metrics .stats-actions{margin-left:auto;display:flex;gap:6px;align-items:center}

/* ---- filters row ---- */
#statsFilters{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 12px}
#statsFilters select{background:var(--panel2);border:1px solid var(--line2);color:var(--txt);padding:7px 11px;border-radius:999px;font-weight:600;font-size:12.5px;max-width:220px}
#statsFilters .seg{border-radius:999px;padding:2px}
#statsFilters .seg button{padding:6px 11px;border-radius:999px;font-size:12px}
#statsFilters .stats-asof{display:flex;align-items:center;gap:6px}
#statsFilters .stats-asof .k{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
#statsFilters input[type=date]{background:var(--panel2);border:1px solid var(--line2);color:var(--txt);padding:6px 9px;border-radius:999px;font-weight:600;font-size:12.5px}
#statsFilters #iuFundLbl{display:none}
#metricViewSampleNote{font-size:12px;color:var(--muted)}

/* ---- overview head ---- */
.ov-hero{display:flex;align-items:flex-end;gap:26px;margin:4px 0 14px}
.ov-hero .n{font-size:44px;font-weight:800;line-height:.95;letter-spacing:-.5px;color:var(--accent)}
.ov-hero .l{color:var(--muted);font-size:14px;margin-top:8px}.ov-hero .l b{color:var(--txt)}
.ov-spark{flex:1;height:60px;border-bottom:1px solid var(--line2);min-width:0}
.ov-spark svg{width:100%;height:100%;display:block}
.ov-qs{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:12px}
.ov-q{background:var(--panel);border:1px solid var(--line2);border-radius:14px;padding:14px 16px;position:relative;overflow:hidden;min-width:0}
.ov-q:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,var(--accent2),var(--accent));opacity:.6}
.ov-q .t{font-size:14px;font-weight:700;display:flex;align-items:center;gap:8px}.ov-q .t i{width:9px;height:9px;border-radius:50%;flex:none}
.ov-q .a{font-size:26px;font-weight:800;margin:8px 0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ov-q .a.g{color:var(--green)}.ov-q .a.r{color:var(--red)}
.ov-q .s{color:var(--muted);font-size:12.5px;line-height:1.45}.ov-q .s b{color:var(--txt)}
.ov-q.ov-losing .s{margin-top:8px}.ov-q.ov-losing .s div+div{margin-top:4px}
.ov-week{display:flex;gap:6px;align-items:center;flex-wrap:wrap;background:var(--panel2);border:1px solid var(--line2);border-radius:999px;padding:8px 16px;font-size:13px;color:var(--muted);margin-bottom:16px}
.ov-week b{color:var(--txt)}

/* ---- label rows: the profit-on-cost bar ---- */
.lot-row{flex-wrap:wrap;row-gap:8px}
.roi-bar{flex:1 1 100%;order:9;height:18px;border-radius:7px;background:var(--panel2);border:1px solid var(--line);position:relative;overflow:hidden;min-width:120px}
.roi-bar i{display:block;height:100%;border-radius:7px;background:var(--green)}
.roi-bar.red i{background:var(--red)}
.roi-bar.gold i{background:linear-gradient(90deg,#e0a800,var(--accent));width:100%!important}
.roi-bar span{position:absolute;right:8px;top:0;bottom:0;display:flex;align-items:center;font-size:11px;font-weight:800;color:var(--txt)}
.roi-bar.gold span{color:#1a1200}
.roi-bar.none i{display:none}.roi-bar.none span{color:var(--muted);font-weight:600}

/* ---- old stock: the age bar ---- */
.age-bar{display:flex;height:34px;border-radius:10px;overflow:hidden;border:1px solid var(--line2);margin:0 0 8px}
.age-bar i{display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#0a0c12;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:150px;padding:0 8px}
.age-bar i[data-agebucket]{cursor:pointer}
.age-bar i.on{box-shadow:inset 0 0 0 2px #fff}
.age-bar.filtered i:not(.on){opacity:.35}
.age-legend{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:12.5px;margin-bottom:14px}.age-legend b{color:var(--txt)}

/* ---- customers: the three boxes ---- */
.ct-boxes{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:14px}

@media(max-width:820px){
  /* Narrow screens: the age bar keeps its proportions and drops its labels (the legend under it
     carries every number); label rows wrap their caption instead of cutting the dollar figure. */
  .age-bar i{min-width:0;font-size:0;padding:0}
  .lot-row .l-name{white-space:normal}
  .ov-qs{grid-template-columns:1fr 1fr}
  .ov-hero{flex-direction:column;align-items:flex-start;gap:10px}.ov-hero .n{font-size:38px}.ov-spark{width:100%}
  .ct-boxes{grid-template-columns:1fr}
  #metricViewSeg{width:100%;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  #metricViewSeg::-webkit-scrollbar{display:none}
  #metricViewSeg button{flex:0 0 auto;white-space:nowrap}
  #metricViewSeg button.locked small{display:none}   /* the dimmed tab and its toast say it is an add-on */
  /* the two-column box grid is ~175px wide here — a currency figure ("C$16,477") fits the
     nowrap+ellipsis rule above, but a words-and-number value ("93.7% of cost") doesn't and
     was clipping to "93.7% of…". Let it wrap to a second line instead of losing the words. */
  .ov-q .a{white-space:normal;overflow:visible;text-overflow:clip;font-size:22px;line-height:1.15}
}

/* ---- the insight boxes (metrics/insights, Ian 2026-09-15): tone paints the top line and a tag ---- */
.ov-q .ov-tag{margin-left:auto;font-size:10.5px;font-weight:700;letter-spacing:.3px;padding:2px 8px;border-radius:999px;background:var(--panel2);color:var(--muted);white-space:nowrap}
.ov-q.bad:before{background:var(--red);opacity:.9}
.ov-q.warn:before{background:var(--orange);opacity:.9}
.ov-q.good:before{background:var(--green);opacity:.9}
.ov-q .a.r{color:var(--red)}
.ov-q.ov-ins .s{margin-top:2px}
@media(max-width:820px){ .ov-q .ov-tag{display:none} }   /* the dot and top line carry the tone; the tag only wraps the title */
