/*! Corbel — sales dashboard for an online and in-store shop — © 2026 Hasib (OVERSHOOT). All rights reserved. Licensed to sjouglard@laboratorioena.com (order INS-2F63AC79), not sold: see LICENSE.md. */
/* Analytics — every class is prefixed .an- (all CSS is global).
   GSAP owns every transform and opacity; CSS only transitions colour. */

.an-toolbar .toolbar__end { gap: 14px; }
.an-compare { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }

/* the cobalt wash for "the rest": mixed into the surface, so the cobalt
   "this one" stays the strongest mark in both themes (dark --c2 is lighter than --c1) */
.an { --an-wash: color-mix(in srgb, var(--c1) 40%, var(--surface)); }

/* ── key figures: one statbar, each cell ends in a quiet sparkline ──── */
.an-kpi { display: flex; flex-direction: column; gap: 6px; }
.an-kpi .stat__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-kpi .stat__val { white-space: nowrap; }
.an-kpi .stat__meta { white-space: nowrap; }
.an-spark { height: 30px; margin-top: 8px; }
.an-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.an-spark__line { fill: none; stroke: var(--c1); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.an-spark__area { fill: url(#an-sgrad); }
.an-sgrad-a { stop-color: var(--c1); stop-opacity: .1; }
:root[data-theme="dark"] .an-sgrad-a { stop-opacity: .16; }

/* ── grid ────────────────────────────────────────────────────────────── */
.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; }
.an-main { grid-column: span 8; }
.an-split { grid-column: span 4; }
.an-funnel-card { grid-column: span 7; }
.an-traffic { grid-column: span 5; }
.an-products { grid-column: span 7; }
.an-week { grid-column: span 5; }

/* ── main chart ──────────────────────────────────────────────────────── */
.an-main { display: flex; flex-direction: column; }
.an-main__head { align-items: flex-start; margin-bottom: 6px; }
.an-main__fig { display: grid; gap: 4px; }
.an-main__total { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.an-main__total b { font-size: var(--fs-display); line-height: 1.1; }
.an-legend { margin-left: auto; display: flex; gap: 16px; font-size: var(--fs-sm); color: var(--muted); }
.an-legend li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.an-sw { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid var(--c1); border-radius: 2px; flex: none; }
.an-sw--prev { border-top: 2px dashed var(--faint); }

.an-chart { position: relative; flex: 1; min-height: 300px; margin: 0 -6px -6px; border-radius: 10px; outline-offset: 4px; touch-action: pan-y; }
.an-chart__svg { position: absolute; inset: 0; display: block; overflow: visible; }
.an-grad-a { stop-color: var(--c1); stop-opacity: .16; }
.an-grad-b { stop-color: var(--c1); stop-opacity: 0; }
:root[data-theme="dark"] .an-grad-a { stop-opacity: .24; }
.an-gridlines line { stroke: var(--line); stroke-width: 1; }
.an-gridlines line:last-of-type { stroke: var(--line-2); }
.an-gridlines text, .an-xlabels text { fill: var(--faint); font: 500 var(--fs-xs) var(--font); font-feature-settings: 'tnum' 1; }
.an-area { fill: url(#an-grad); }
.an-line { fill: none; stroke: var(--c1); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.an-prev { fill: none; stroke: var(--faint); stroke-width: 1.7; stroke-dasharray: 5 5; stroke-linecap: round; opacity: .8; }
.an-cross { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.an-dot { fill: var(--surface); stroke: var(--c1); stroke-width: 3; pointer-events: none; }
.an-dot--prev { stroke: var(--faint); stroke-width: 2; }

.an-tip {
  position: absolute; left: 0; top: 0; z-index: 2;
  display: grid; gap: 5px; min-width: 196px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm); pointer-events: none;
}
.an-tip > b { font-weight: 600; font-size: var(--fs-sm); }
.an-tip__row { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.an-tip__row b { margin-left: auto; color: var(--text); font-weight: 600; padding-left: 12px; }
.an-tip__row .an-sw { width: 12px; }
.an-tip__delta { font-size: var(--fs-xs); font-weight: 600; color: var(--up); }
.an-tip__delta.is-down { color: var(--down); }

/* ── channel split ───────────────────────────────────────────────────── */
.an-split { display: flex; flex-direction: column; }
.an-split__share { display: grid; gap: 10px; }
.an-split__pcts { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-sm); }
.an-split__pcts b { font: 600 var(--fs-3xl)/1.1 var(--display); color: var(--text); margin-right: 4px; }
.an-split__track { position: relative; height: 10px; border-radius: 999px; background: var(--well); overflow: hidden; }
.an-split__fill { position: absolute; top: 0; bottom: 0; width: 100%; }
.an-split__fill--on { left: 0; background: var(--c1); transform-origin: 0 50%; border-radius: 999px 0 0 999px; }
.an-split__fill--st { right: 0; background: var(--c3); transform-origin: 100% 50%; border-radius: 0 999px 999px 0; box-shadow: -2px 0 0 var(--surface); }
.an-split__rows { display: grid; margin: 16px 0; }
.an-split__row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.an-split__row:last-child { border-bottom: 0; }
/* the row's key: the same colour as its half of the bar above */
.an-split__key { width: 10px; height: 10px; border-radius: 3px; flex: none; align-self: flex-start; margin-top: 6px; }
.an-split__key--online { background: var(--c1); }
.an-split__key--store { background: var(--c3); }
.an-split__txt { display: grid; min-width: 0; line-height: 1.35; }
.an-split__txt b { font-weight: 600; }
.an-split__txt small { color: var(--faint); font-size: var(--fs-xs); }
.an-split__fig { margin-left: auto; display: grid; justify-items: end; gap: 4px; }
.an-split__fig b { font: 600 var(--fs-xl)/1.2 var(--display); letter-spacing: -.015em; }
.an-split__note { margin-top: auto; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }

/* ── funnel ──────────────────────────────────────────────────────────── */
.an-funnel { display: grid; }
.an-fstep { display: grid; gap: 8px; }
.an-fstep__top { display: flex; align-items: baseline; gap: 12px; font-size: var(--fs-sm); }
.an-fstep__name { color: var(--muted); font-weight: 500; }
.an-fstep__top b { margin-left: auto; font-weight: 600; font-size: var(--fs-base); }
.an-fstep__pct { min-width: 44px; text-align: right; color: var(--faint); font-size: var(--fs-xs); }
.an-fstep__track { height: 12px; border-radius: 999px; background: var(--well); overflow: hidden; }
.an-fstep__fill { display: block; height: 100%; border-radius: inherit; background: var(--c1); transform-origin: 0 50%; }
.an-drop { display: flex; align-items: center; gap: 4px; padding: 8px 0; font-size: var(--fs-xs); color: var(--faint); }
.an-drop span { color: var(--muted); font-weight: 600; }
/* the biggest leak is the one that matters */
.an-drop.is-worst span { color: var(--down); }

/* ── traffic ─────────────────────────────────────────────────────────── */
.an-traffic { display: flex; flex-direction: column; }
.an-traffic__body { flex: 1; display: grid; grid-template-columns: minmax(120px, 210px) minmax(170px, 1fr); gap: 18px; align-items: center; }
.an-donut { position: relative; aspect-ratio: 1; }
.an-donut svg { display: block; width: 100%; height: 100%; overflow: visible; }
.an-donut__track { fill: none; stroke: var(--well); stroke-width: 18; }
.an-donut__seg { fill: none; stroke-width: 18; stroke-dasharray: 0 100; cursor: pointer; }
.an-donut__mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.an-donut__mid b { font-size: var(--fs-3xl); line-height: 1.1; }
.an-donut__mid span { color: var(--faint); font-size: var(--fs-xs); }
.an-legend-list { display: grid; gap: 2px; }
.an-src {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px;
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm); text-align: left;
  transition: background-color .2s;
}
.an-src:hover, .an-src.is-hl { background: var(--surface-2); }
.an-src__sw { grid-row: span 2; align-self: center; width: 10px; height: 10px; border-radius: 3px; }
.an-src span { font-weight: 500; }
.an-src b { font-weight: 600; text-align: right; }
.an-src small { grid-column: 2 / 4; color: var(--faint); font-size: var(--fs-xs); }

/* ── products ────────────────────────────────────────────────────────── */
.an-ptable td { padding-top: 8px; padding-bottom: 8px; }
.an-rank { width: 30px; color: var(--faint); font-weight: 600; }
.an-plink { color: inherit; }
.an-plink:hover b { color: var(--primary-ink); }
.an-ptable__bar { width: 26%; min-width: 110px; }
.an-pbar { display: block; height: 6px; border-radius: 999px; background: var(--well); overflow: hidden; }
.an-pbar__fill { display: block; height: 100%; border-radius: inherit; background: var(--c1); transform-origin: 0 50%; }
/* the top seller in cobalt, the rest in the wash */
.an-ptable tr:not([hidden]) ~ tr .an-pbar__fill { background: var(--an-wash); }

/* ── weekday / hour ──────────────────────────────────────────────────── */
.an-week { display: flex; flex-direction: column; }
.an-week__cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: -4px 0 16px; font-size: var(--fs-sm); }
.an-week__cap b { font-weight: 600; }
.an-week__cap span { color: var(--faint); }
.an-bars { --n: 7; flex: 1 1 172px; min-height: 172px; max-height: 236px; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: clamp(2px, calc(56px / var(--n)), 12px); align-items: stretch; border-bottom: 1px solid var(--line-2); }
.an-bar { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; border-radius: var(--r-xs) var(--r-xs) 0 0; overflow: hidden; outline-offset: 2px; transition: background-color .2s; }
.an-bar:hover { background: var(--well); }
.an-bar__fill { display: block; width: min(100%, 28px); height: 100%; border-radius: 6px 6px 2px 2px; background: var(--an-wash); transform-origin: 50% 100%; transition: background-color .2s; }
.an-bars--h .an-bar__fill { border-radius: 3px 3px 1px 1px; }
.an-bar.is-on .an-bar__fill { background: var(--c1); }
.an-bars__x { --n: 7; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: clamp(2px, calc(56px / var(--n)), 12px); margin-top: 8px; font-size: var(--fs-xs); color: var(--faint); text-align: center; white-space: nowrap; }
.an-bars__x span { overflow: visible; }
.an-week__sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: auto 0 0; padding-top: 16px; }
.an-week__sum > div { display: grid; gap: 2px; padding: 12px 0 0 12px; border-top: 1px solid var(--line); }
.an-week__sum > div:first-child { padding-left: 0; }
.an-week__sum > div + div { border-left: 1px solid var(--line); }
.an-week__sum dt { color: var(--faint); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-week__sum dd { margin: 0; font: 600 var(--fs-xl)/1.2 var(--display); letter-spacing: -.015em; }

/* ── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  /* revenue leads across the top, the other four sit two by two */
  .statbar.an-kpis > :first-child { grid-column: span 2; }
  .an-main, .an-products { grid-column: span 12; }
  .an-split, .an-funnel-card, .an-traffic, .an-week { grid-column: span 6; }
  .an-traffic__body { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .an-donut { width: min(190px, 100%); }
  .an-legend-list { width: 100%; }
}
@media (max-width: 760px) {
  .an-split, .an-funnel-card, .an-traffic, .an-week { grid-column: span 12; }
  .an-traffic__body { grid-template-columns: minmax(130px, 160px) minmax(0, 1fr); justify-items: stretch; }
  .an-donut { width: 100%; }
}
@media (max-width: 560px) {
  .an-toolbar { gap: 8px; }
  .an-toolbar .seg { width: 100%; }
  .an-toolbar .toolbar__end { margin-left: 0; width: 100%; justify-content: space-between; }
  .an-kpi .stat__label { font-size: var(--fs-xs); }
  .statbar.an-kpis > :first-child .stat__val { font-size: var(--fs-4xl); }
  .an-kpi .an-kpi__vs { display: none; }
  .an-spark { height: 26px; margin-top: 4px; }
  .an-main__head { flex-wrap: wrap; }
  .an-legend { margin-left: 0; width: 100%; }
  .an-main__total b { font-size: var(--fs-4xl); }
  .an-chart { min-height: 230px; }
  .an-traffic__body { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .an-donut { width: min(180px, 100%); }
  .an-ptable small { display: none; }
  .an-funnel-card [data-funnel-note] { display: none; }
  .an-ptable__bar { min-width: 70px; }
  .an-ptable th:nth-child(3), .an-ptable td:nth-child(3) { display: none; }
  .an-bars { flex-basis: 148px; min-height: 148px; max-height: 180px; }
}
