/*
  Cifra · componentes custom sobre Polaris Web Components 2.0-rc
  ----------------------------------------------------------------
  Todo lo que NO existe como <s-*> vive aquí, con clases .c-*.
  Los valores replican lo que renderiza polaris-2.0-rc.js en Admin Next
  (medido con getComputedStyle sobre los componentes reales).
  Cada bloque custom lleva data-custom="Nombre" en el HTML para poder
  resaltarlo con el botón "Resaltar custom" de la barra de prototipos.
*/

:root {
  /* Superficies y texto (Admin Next) */
  --c-bg: #f1f1f1;
  --c-surface: #ffffff;
  --c-surface-hover: #f7f7f7;
  --c-surface-subdued: #f3f3f3;
  --c-fill-secondary: #ebebeb;
  --c-fill-secondary-hover: #e3e3e3;
  --c-text: #101010;
  --c-text-secondary: #616161;
  --c-text-tertiary: #8a8a8a;
  --c-border: #e3e3e3;
  --c-border-strong: #cccccc;

  /* Tono de variaciones */
  --c-positive: #29845a;
  --c-negative: #c51f1f;

  /* Gráficas (paleta Cifra actual) */
  --c-chart-1: #3aa9f0;
  --c-chart-2: #5b3fd6;
  --c-chart-3: #4a6ff0;
  --c-chart-4: #e0448f;
  --c-chart-5: #36c2b4;
  --c-chart-grid: #ececec;
  --c-chart-area: rgba(58, 169, 240, 0.10);

  /* Forma */
  --c-radius-card: 20px;
  --c-radius-control: 9999px;
  --c-radius-inner: 12px;
  --c-radius-small: 8px;
  --c-shadow-card: rgba(0,0,0,.24) 0 0 2px 0, rgba(0,0,0,.02) 0 2px 12px 0, rgba(0,0,0,.02) 0 4px 16px 0, rgba(0,0,0,.02) 0 4px 48px 0;
  --c-shadow-popover: rgba(0,0,0,.2) 0 0 1px 0, rgba(0,0,0,.08) 0 8px 24px -4px, rgba(0,0,0,.08) 0 16px 40px -8px;

  /* Tipografía */
  --c-font: ShopifyInter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --c-fs-small: 12px;
  --c-fs-base: 13px;
  --c-fs-kpi: 20px;
  --c-fs-kpi-large: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--c-font);
  font-size: var(--c-fs-base);
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ */
/* Barra de prototipos (NO es parte de la app)                         */
/* ------------------------------------------------------------------ */
.proto-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 16px;
  background: #1a1a1a; color: #fff;
  font-size: 12px;
}
.proto-bar strong { margin-right: 12px; font-weight: 600; }
.proto-bar a {
  color: #cfcfcf; text-decoration: none;
  padding: 4px 10px; border-radius: 9999px;
}
.proto-bar a:hover { background: #2e2e2e; color: #fff; }
.proto-bar a[aria-current="page"] { background: #fff; color: #101010; }
.proto-bar .spacer { flex: 1; }
.proto-bar button {
  font: inherit; color: #fff; background: #2e2e2e; border: 0;
  padding: 4px 10px; border-radius: 9999px; cursor: pointer;
}
.proto-bar button[aria-pressed="true"] { background: #e5484d; }

body.show-custom [data-custom] {
  outline: 2px dashed #e5484d;
  outline-offset: 2px;
  position: relative;
}
body.show-custom [data-custom]::before {
  content: "custom · " attr(data-custom);
  position: absolute; top: -10px; left: 10px; z-index: 5;
  background: #e5484d; color: #fff;
  font: 600 10px/16px var(--c-font);
  padding: 0 6px; border-radius: 4px; white-space: nowrap;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Card custom (para cuando s-section no alcanza: header/footer propio) */
/* ------------------------------------------------------------------ */
.c-card {
  background: var(--c-surface);
  border-radius: var(--c-radius-card);
  box-shadow: var(--c-shadow-card);
  overflow: hidden;
  min-width: 0;
}
.c-card { display: flex; flex-direction: column; }
.c-card__body { padding: 16px; flex: 1; }
.c-card__footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--c-border);
  color: var(--c-text-secondary);
}
.c-card__title {
  margin: 0; font-size: var(--c-fs-base); font-weight: 600;
  text-decoration: underline dotted var(--c-border-strong);
  text-underline-offset: 4px;
}

/* ------------------------------------------------------------------ */
/* Botón-píldora custom (trigger de pickers con contenido propio)       */
/* ------------------------------------------------------------------ */
.c-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 4px 12px 4px 8px;
  border: 0; border-radius: var(--c-radius-control);
  background: var(--c-fill-secondary); color: var(--c-text);
  font: 500 var(--c-fs-small)/16px var(--c-font);
  cursor: pointer; white-space: nowrap;
}
.c-pill:hover { background: var(--c-fill-secondary-hover); }
.c-pill svg { width: 16px; height: 16px; flex: none; }

/* ------------------------------------------------------------------ */
/* Tabs                                                                 */
/* ------------------------------------------------------------------ */
.c-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.c-tabs__tab {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 4px 12px;
  border: 0; border-radius: var(--c-radius-control);
  background: transparent; color: var(--c-text-secondary);
  font: 500 var(--c-fs-small)/16px var(--c-font);
  cursor: pointer;
}
.c-tabs__tab:hover { background: var(--c-fill-secondary); color: var(--c-text); }
.c-tabs__tab[aria-selected="true"] { background: var(--c-fill-secondary); color: var(--c-text); }
.c-tabs__tab svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ */
/* Segmented control                                                    */
/* ------------------------------------------------------------------ */
.c-segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 2px; gap: 2px;
  background: var(--c-surface-subdued);
  border-radius: var(--c-radius-control);
}
.c-segmented button {
  height: 28px; border: 0; border-radius: var(--c-radius-control);
  background: transparent; color: var(--c-text-secondary);
  font: 500 var(--c-fs-small)/16px var(--c-font); cursor: pointer;
}
.c-segmented button[aria-pressed="true"] {
  background: var(--c-surface); color: var(--c-text);
  box-shadow: rgba(0,0,0,.12) 0 1px 2px, rgba(0,0,0,.06) 0 0 0 1px;
}

/* ------------------------------------------------------------------ */
/* Barra de filtros (fecha / comparación / moneda)                      */
/* ------------------------------------------------------------------ */
.c-filterbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.c-filterbar__meta { margin-left: auto; color: var(--c-text-secondary); font-size: var(--c-fs-small); }

/* ------------------------------------------------------------------ */
/* Popover custom (date range picker)                                   */
/* ------------------------------------------------------------------ */
.c-popover-anchor { position: relative; display: inline-block; }
.c-popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  background: var(--c-surface);
  border-radius: 16px;
  box-shadow: var(--c-shadow-popover);
  display: none;
}
.c-popover[data-open="true"] { display: block; }

.c-daterange { display: grid; grid-template-columns: 180px auto; }
.c-daterange__presets {
  border-right: 1px solid var(--c-border);
  padding: 6px; max-height: 340px; overflow: auto;
}
.c-daterange__presets button {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; height: 32px; padding: 0 10px;
  border: 0; border-radius: var(--c-radius-small); background: transparent;
  font: 400 var(--c-fs-base)/20px var(--c-font); color: var(--c-text);
  text-align: left; cursor: pointer;
}
.c-daterange__presets button:hover { background: var(--c-surface-hover); }
.c-daterange__presets button[aria-pressed="true"] { background: var(--c-surface-subdued); font-weight: 600; }
.c-daterange__presets hr { border: 0; border-top: 1px solid var(--c-border); margin: 6px 4px; }
.c-daterange__main { padding: 12px 16px; min-width: 300px; }
.c-daterange__footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--c-border);
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------ */
/* KPI card (dashboard / home)                                          */
/* ------------------------------------------------------------------ */
.c-kpi__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.c-kpi__value { font-size: var(--c-fs-kpi); line-height: 28px; font-weight: 600; letter-spacing: -0.2px; font-variant-numeric: tabular-nums; }
.c-kpi__value--large { font-size: var(--c-fs-kpi-large); line-height: 36px; }
.c-delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--c-fs-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.c-delta--up { color: var(--c-positive); }
.c-delta--down { color: var(--c-negative); }
.c-delta--flat { color: var(--c-text-secondary); }
.c-delta svg { width: 12px; height: 12px; }
.c-spark { width: 96px; height: 28px; flex: none; }

/* KPI compacto del Home */
.c-kpistrip { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.c-kpistrip__item { text-align: center; }
.c-kpistrip__label { color: var(--c-text-secondary); font-size: var(--c-fs-small); }
.c-kpistrip__row { display: flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.c-kpistrip .c-spark { width: 36px; height: 14px; }

/* ------------------------------------------------------------------ */
/* Gráficas (SVG generado por cifra.js)                                 */
/* ------------------------------------------------------------------ */
.c-chart { width: 100%; height: 220px; display: block; }
.c-chart text { font: 11px var(--c-font); fill: var(--c-text-secondary); }
.c-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; color: var(--c-text-secondary); font-size: var(--c-fs-small); margin-top: 6px; }
.c-legend__swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.c-legend__dash { display: inline-block; width: 14px; border-top: 2px dashed var(--c-chart-1); margin-right: 6px; vertical-align: middle; }

.c-donut { display: grid; justify-items: center; gap: 12px; }
.c-donut svg { width: 180px; height: 180px; }
.c-donut__total { font: 600 18px var(--c-font); fill: var(--c-text); }
.c-donut__list { width: 100%; display: grid; gap: 4px; }
.c-donut__list div { display: grid; grid-template-columns: auto 1fr auto 40px; gap: 8px; align-items: center; }
.c-donut__list span:nth-child(3), .c-donut__list span:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
.c-donut__list span:nth-child(3) { font-weight: 600; }
.c-donut__list span:nth-child(4) { color: var(--c-text-secondary); }

/* ------------------------------------------------------------------ */
/* Tabla de reporte (sticky header + 1ra columna, totales, orden)       */
/* ------------------------------------------------------------------ */
.c-datatable {
  overflow: auto; max-height: 520px;
  border-radius: var(--c-radius-card);
  background: var(--c-surface);
  box-shadow: var(--c-shadow-card);
}
.c-datatable table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
.c-datatable th, .c-datatable td {
  padding: 8px 16px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}
.c-datatable th:first-child, .c-datatable td:first-child {
  position: sticky; left: 0; z-index: 1; text-align: left;
  border-right: 1px solid var(--c-border); min-width: 220px;
}
.c-datatable thead th {
  position: sticky; top: 0; z-index: 2;
  font-weight: 500; color: var(--c-text-secondary); background: var(--c-surface);
  height: 40px;
}
.c-datatable thead th:first-child { z-index: 3; }
.c-datatable thead button {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.c-datatable thead button:hover { color: var(--c-text); }
.c-datatable thead button svg { width: 14px; height: 14px; opacity: .35; }
.c-datatable thead th[aria-sort] button { color: var(--c-text); }
.c-datatable thead th[aria-sort] button svg { opacity: 1; }
.c-datatable tr.c-total td { background: var(--c-surface-subdued); font-weight: 600; vertical-align: top; }
.c-datatable tr.c-total td:first-child { color: var(--c-text); }
.c-datatable tbody tr:not(.c-total):hover td { background: var(--c-surface-hover); }
.c-datatable .c-sub { display: block; color: var(--c-text-secondary); font-weight: 400; }
.c-datatable td .c-delta { display: flex; justify-content: flex-end; }
.c-datatable td:first-child .c-sub { font-weight: 400; }

/* ------------------------------------------------------------------ */
/* Panel lateral de configuración de reporte                           */
/* ------------------------------------------------------------------ */
.c-config { display: grid; gap: 10px; }
.c-config__block {
  border: 1px solid var(--c-border); border-radius: var(--c-radius-inner);
  overflow: hidden;
}
.c-config__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--c-surface-subdued); font-weight: 600;
}
.c-config__item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; border-top: 1px solid var(--c-border);
}
.c-config__item:hover { background: var(--c-surface-hover); }

/* ------------------------------------------------------------------ */
/* Layout reporte con panel (grid principal + aside)                    */
/* ------------------------------------------------------------------ */
.c-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .c-split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ */
/* Settings: menú lateral                                               */
/* ------------------------------------------------------------------ */
.c-settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .c-settings { grid-template-columns: 1fr; } }
.c-sidenav { padding: 6px; }
.c-sidenav a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--c-radius-small);
  color: var(--c-text); text-decoration: none; font-weight: 500;
}
.c-sidenav a:hover { background: var(--c-surface-hover); }
.c-sidenav a[aria-current="page"] { background: var(--c-surface-subdued); }
.c-sidenav svg { width: 16px; height: 16px; color: var(--c-text-secondary); }

/* ------------------------------------------------------------------ */
/* Home                                                                 */
/* ------------------------------------------------------------------ */
.c-hero { text-align: center; padding: 28px 0 8px; }
.c-hero h2 { margin: 0; font-size: 26px; line-height: 32px; font-weight: 600; color: var(--c-text-tertiary); }
.c-hero p { margin: 0; font-size: 26px; line-height: 32px; font-weight: 600; }
.c-prompt {
  display: flex; align-items: center; gap: 8px;
  max-width: 640px; margin: 20px auto 8px; padding: 6px 6px 6px 12px;
  background: var(--c-surface); border-radius: var(--c-radius-control);
  box-shadow: var(--c-shadow-card);
}
.c-prompt input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: 400 var(--c-fs-base)/20px var(--c-font); color: var(--c-text);
}
.c-prompt__logo { width: 22px; height: 22px; border-radius: 6px; background: #2f6cf6; display: grid; place-items: center; color: #fff; font: 700 12px var(--c-font); }
.c-illustration {
  width: 120px; height: 96px; border-radius: 16px;
  background: linear-gradient(135deg, #e7ecff, #c9d4ff);
  display: grid; place-items: center; color: #4a6ff0;
}
.c-illustration svg { width: 48px; height: 48px; }

/* ------------------------------------------------------------------ */
/* Skeleton                                                             */
/* ------------------------------------------------------------------ */
.c-skeleton {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #ececec 25%, #f6f6f6 37%, #ececec 63%);
  background-size: 400% 100%;
  animation: c-shimmer 1.4s ease infinite;
}
@keyframes c-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .c-skeleton { animation: none; } }

/* ------------------------------------------------------------------ */
/* Utilidades                                                           */
/* ------------------------------------------------------------------ */
.c-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.c-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.c-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .c-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .c-grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .c-grid-4, .c-grid-2 { grid-template-columns: 1fr; } }
.c-muted { color: var(--c-text-secondary); }
.c-section-label { color: var(--c-text-secondary); font-weight: 500; margin: 20px 0 8px; }
.c-stack { display: grid; gap: 16px; }
[data-tabpanel][hidden] { display: none !important; }
s-page > [slot="unused"] { display: none !important; }
.c-row { display: flex; align-items: center; gap: 8px; }
.c-row--between { justify-content: space-between; }
.c-source { width: 24px; height: 24px; border-radius: 6px; background: #95bf47; display: grid; place-items: center; color: #fff; font: 700 11px var(--c-font); }

/* ------------------------------------------------------------------ */
/* Metric tree: canvas, nodos, conectores con operador, zoom            */
/* ------------------------------------------------------------------ */
.c-canvas {
  position: relative; overflow: auto;
  height: 600px; border-radius: var(--c-radius-card);
  background-color: #f1f1f1;
  background-image: radial-gradient(#d4d4d4 1px, transparent 1px);
  background-size: 16px 16px;
}
.c-canvas__stage { padding: 48px; width: max-content; transform-origin: 0 0; transition: transform .15s ease; }
.c-canvas__zoom {
  position: absolute; left: 16px; bottom: 16px; z-index: 2;
  display: flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--c-surface); border-radius: var(--c-radius-small); box-shadow: var(--c-shadow-card);
}
.c-canvas__zoom button { all: unset; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--c-text-secondary); }
.c-canvas__zoom button:hover { background: var(--c-surface-hover); color: var(--c-text); }
.c-canvas__zoom span { min-width: 44px; text-align: center; font-size: var(--c-fs-small); }
.c-canvas__panel { position: absolute; top: 16px; right: 16px; z-index: 2; width: 240px; max-height: calc(100% - 32px); overflow: auto; }
.c-canvas__panel[hidden] { display: none; }

.c-tree, .c-tree ul { list-style: none; margin: 0; }
.c-tree { padding: 0; }
.c-tree li { position: relative; display: flex; align-items: center; padding: 6px 0; }
.c-tree ul { position: relative; padding: 0 0 0 56px; display: flex; flex-direction: column; }
/* línea del padre hacia los hijos */
.c-tree ul::before { content: ""; position: absolute; left: 0; top: 50%; width: 28px; border-top: 1px solid var(--c-border-strong); }
/* rama horizontal de cada hijo */
.c-tree ul > li::before { content: ""; position: absolute; left: -28px; top: 50%; width: 28px; border-top: 1px solid var(--c-border-strong); }
/* tronco vertical */
.c-tree ul > li::after { content: ""; position: absolute; left: -28px; top: 0; bottom: 0; border-left: 1px solid var(--c-border-strong); }
.c-tree ul > li:first-child::after { top: 50%; }
.c-tree ul > li:last-child::after { bottom: 50%; }
.c-tree ul > li:only-child::after { display: none; }

.c-tree__op {
  position: absolute; left: -28px; top: 50%; z-index: 1;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--c-surface); border: 1px solid var(--c-border-strong); box-shadow: rgba(0,0,0,.08) 0 1px 2px;
  font: 600 11px/1 var(--c-font); color: var(--c-text-secondary);
}
.c-tree__node {
  min-width: 200px; padding: 10px 12px;
  background: var(--c-surface); border-radius: var(--c-radius-inner);
  box-shadow: var(--c-shadow-card);
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2px 12px;
  margin-right: 0;
}
.c-tree__node--root { min-width: 220px; }
.c-tree__node--wide { min-width: 300px; }
.c-tree__label { grid-column: 1 / -1; color: var(--c-text-secondary); font-size: var(--c-fs-small); }
.c-tree__value { font-size: 18px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.c-tree__node .c-source { width: 18px; height: 18px; font-size: 9px; border-radius: 4px; }
.c-tree__node .c-delta { grid-column: 1 / -1; }

.c-metriclist__group { color: var(--c-text-secondary); font-size: var(--c-fs-small); padding: 8px 8px 2px; }
.c-metriclist button {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 6px 8px; border-radius: var(--c-radius-small);
}
.c-metriclist button:hover { background: var(--c-surface-hover); }
.c-metriclist button[aria-pressed="true"] { background: var(--c-surface-subdued); font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Settings (layout real: centrado ~950px, nav 1/3 + contenido 2/3)     */
/* ------------------------------------------------------------------ */
.c-settings2 {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px; align-items: start;
  max-width: 950px; margin: 0 auto; padding-top: 20px;
}
@media (max-width: 760px) { .c-settings2 { grid-template-columns: 1fr; } }
.c-settingsnav { padding: 6px; display: grid; gap: 2px; }
.c-settingsnav a {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px; border-radius: var(--c-radius-small);
  color: var(--c-text); text-decoration: none; font-weight: 500;
}
.c-settingsnav a:hover { background: var(--c-surface-hover); }
.c-settingsnav a[aria-current="page"] { background: var(--c-surface-subdued); font-weight: 600; }
.c-settings-view[hidden] { display: none; }

/* Fila de lista dentro de una card (Costs, Resources) */
.c-listrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--c-border);
  color: inherit; text-decoration: none;
}
a.c-listrow:hover { background: var(--c-surface-hover); }
.c-listrow__title { font-weight: 600; }
.c-listrow__desc { color: var(--c-text-secondary); }

/* Caja interna con borde (Billing, Reporting, Stores...) */
.c-inset { border: 1px solid var(--c-border); border-radius: var(--c-radius-inner); }
.c-inset > .c-listrow:first-child { border-top: 0; }

/* ------------------------------------------------------------------ */
/* IndexTable custom (tablas de costos): tabs + toolbar + selección +   */
/* orden + footer con conteo y paginación                               */
/* ------------------------------------------------------------------ */
.c-indextable { background: var(--c-surface); border-radius: var(--c-radius-card); box-shadow: var(--c-shadow-card); overflow: hidden; }
.c-indextable__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; min-height: 48px; }
.c-indextable__tools { display: flex; gap: 6px; margin-left: auto; }
.c-indextable__scroll { overflow-x: auto; }
.c-indextable table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
/* Medido en admin.shopify.com/.../customers: encabezado 31px (#f7f7f7, 12px/500, #4a4a4a), filas de 32px, celdas con 6px de padding */
.c-indextable th {
  text-align: left; font-weight: 500; color: #4a4a4a; background: #f7f7f7;
  height: 31px; padding: 6px 12px; white-space: nowrap; border: 0;
}
.c-indextable th:first-child { border-radius: 8px 0 0 8px; }
.c-indextable th:last-child { border-radius: 0 8px 8px 0; }
.c-indextable th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.c-indextable th button:hover { color: var(--c-text); }
.c-indextable th s-icon { color: #8a8a8a; }
.c-indextable td { padding: 6px 12px; height: 32px; border-bottom: 1px solid #f2f2f2; white-space: nowrap; }
.c-indextable tr:last-child td { border-bottom: 0; }
.c-indextable tbody tr:hover td { background: #f7f7f7; }
.c-indextable .c-col-check { width: 36px; padding-right: 0; }
.c-indextable .c-col-actions { width: 48px; text-align: right; }
.c-indextable .c-num { text-align: right; }
.c-indextable .c-strong { font-weight: 500; }
.c-indextable tr[data-readonly] td { color: var(--c-text-tertiary); }
.c-indextable tr[data-readonly] .c-strong { color: var(--c-text-secondary); }
.c-indextable__scroll { padding: 0 4px; }
.c-indextable__bar--stack { flex-direction: column; align-items: stretch; gap: 8px; }
.c-indextable__search { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.c-indextable__filters { display: flex; gap: 8px; }
.c-indextable__filters:empty { display: none; }
.c-rowlink { color: inherit; text-decoration: none; }
.c-rowlink:hover { text-decoration: underline; }
.c-author { display: inline-flex; align-items: center; gap: 8px; }
.c-brandbox.c-brandbox--sm { width: 24px; height: 24px; border-radius: 8px; border: 0; background: none; }
.c-brandbox.c-brandbox--sm img { width: 24px; height: 24px; }
/* Variante "list" (Reports) — medida en admin.shopify.com/.../analytics/reports:
   búsqueda sin borde, pills con borde punteado, encabezado gris a ancho completo */
.c-indextable--list .c-indextable__bar { padding: 0; gap: 0; }
.c-indextable--list .c-indextable__search { padding: 6px 12px 6px 8px; border-bottom: 1px solid #f2f2f2; }
.c-indextable--list .c-indextable__searchbox { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 4px; color: var(--c-text-secondary); cursor: text; }
.c-indextable--list .c-indextable__searchbox input { all: unset; flex: 1; min-width: 0; font: 13px/20px var(--c-font); color: var(--c-text); }
.c-indextable--list .c-indextable__searchbox input::placeholder { color: var(--c-text-secondary); }
.c-indextable--list .c-indextable__filters { padding: 8px 12px; gap: 6px; }
.c-fpill {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 4px 0 10px;
  background: var(--c-surface); border: 1px dashed #ddd; border-radius: 9999px;
  font: 13px/20px var(--c-font); color: var(--c-text);
}
.c-fpill:hover { background: var(--c-surface-hover); }
.c-fpill:focus-visible { outline: 2px solid #005bd3; outline-offset: 1px; }
.c-fpill s-icon { color: var(--c-text-secondary); }
.c-indextable--list .c-indextable__scroll { padding: 0; }
.c-indextable--list th { background: #f7f7f7; height: 36px; padding: 8px 6px 8px 12px; border-top: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb; border-radius: 0; }
.c-indextable--list th:first-child { padding-left: 16px; border-radius: 0; }
.c-indextable--list th:last-child { border-radius: 0; }
.c-indextable--list td:first-child { padding-left: 16px; }
.c-indextable__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; color: var(--c-text-secondary); font-size: 12px;
}
.c-cellinput {
  width: 72px; height: 32px; padding: 0 10px;
  border: 1px solid var(--c-border-strong); border-radius: var(--c-radius-small);
  font: inherit; color: var(--c-text); background: var(--c-surface);
}
.c-cellinput:focus { outline: 2px solid #005bd3; outline-offset: 0; }

/* ------------------------------------------------------------------ */
/* Choice cards (Add Costs: Fixed / Variable)                           */
/* ------------------------------------------------------------------ */
.c-choicecards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.c-choicecard {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--c-border); border-radius: var(--c-radius-inner);
  cursor: pointer; background: var(--c-surface);
}
.c-choicecard:has(input:checked) { border: 2px solid #005bd3; padding: 11px 13px; }
.c-choicecard input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: #101010; }
.c-choicecard strong { font-weight: 500; }
.c-choicecard span { grid-column: 2; color: var(--c-text-secondary); }

/* Callout informativo (Add Costs) */
.c-callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--c-border); border-radius: var(--c-radius-inner); }
.c-callout__icon { flex: none; width: 28px; height: 28px; border-radius: 8px; background: #cfe8ff; display: grid; place-items: center; }

/* Pasos numerados (Shipping) */
.c-step { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--c-border); display: grid; place-items: center; font-size: var(--c-fs-small); color: var(--c-text-secondary); }
.c-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Dashboard · Customize (editor a pantalla completa)                   */
/* En la app: App Bridge max modal. Aquí se simula con un overlay.      */
/* ------------------------------------------------------------------ */
.c-editor { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.45); padding: 12px; }
.c-editor__frame { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--c-bg); border-radius: 16px; overflow: hidden; box-shadow: var(--c-shadow-popover); }
.c-editor__bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.c-editor__title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-right: auto; }
.c-editor__appicon { width: 20px; height: 20px; border-radius: 5px; background: #2f6cf6; color: #fff; display: grid; place-items: center; font: 700 11px var(--c-font); }
.c-editor__body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; padding: 16px; min-height: 0; }

.c-library { display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--c-surface); border-radius: var(--c-radius-card); box-shadow: var(--c-shadow-card); min-height: 0; }
.c-library__head { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px; }
.c-library__list { overflow: auto; padding: 0 8px 12px; }
.c-library__group { color: var(--c-text-secondary); padding: 10px 8px 4px; }
.c-library__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: var(--c-radius-small); cursor: grab; position: relative;
  white-space: nowrap;
}
.c-library__item span { overflow: hidden; text-overflow: ellipsis; }
.c-library__item:hover { background: var(--c-surface-hover); }
.c-library__item .c-grip { opacity: 0; }
.c-library__item:hover .c-grip { opacity: 1; }
.c-preview { z-index: 9100 !important;
  position: fixed; z-index: 70; width: 300px; padding: 14px 16px; pointer-events: none;
  background: var(--c-surface); border-radius: var(--c-radius-inner); box-shadow: var(--c-shadow-popover);
}
.c-preview[hidden] { display: none; }
.c-preview .c-chart { height: 70px; }

.c-canvasgrid {
  overflow: auto; min-height: 0; padding: 4px; margin: -4px;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: min-content; gap: 16px; align-content: start;
}
.c-widget { position: relative; grid-column: span var(--span, 3); background: var(--c-surface); border-radius: var(--c-radius-inner); box-shadow: var(--c-shadow-card); display: flex; flex-direction: column; min-width: 0; }
.c-widget[aria-selected="true"] { outline: 2px solid #005bd3; outline-offset: 0; }
.c-widget.is-dragging { opacity: .4; }
.c-widget.is-over { outline: 2px dashed #005bd3; }
.c-widget__head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 0 12px; }
.c-widget__head .c-card__title { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-grip { cursor: grab; color: var(--c-text-secondary); display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; }
.c-widget__body { padding: 8px 12px 12px; flex: 1; }
.c-widget .c-card__footer { padding: 8px 12px; }
.c-widget__resize {
  position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; cursor: ew-resize; display: none;
  background: linear-gradient(135deg, transparent 50%, #005bd3 50%); border-bottom-right-radius: 10px;
}
.c-widget[aria-selected="true"] .c-widget__resize { display: block; }
.c-slot { grid-column: span 1; height: 34px; border: 1.5px dashed var(--c-border-strong); border-radius: 10px; }
.c-canvasgrid.is-dropping .c-slot { border-color: #005bd3; background: rgba(0,91,211,.05); }

/* assets reales */
.c-source { width: 28px !important; height: 28px !important; border-radius: 8px !important; background: var(--c-surface) !important; border: 1px solid var(--c-border); display: inline-grid !important; place-items: center; flex: none; }
.c-source img { width: 16px; height: 16px; display: block; }
.c-tree__node .c-source { width: 22px !important; height: 22px !important; border-radius: 6px !important; }
.c-tree__node .c-source img { width: 13px; height: 13px; }
.c-delta svg { width: 12px; height: 12px; flex: none; }
.c-prompt__logo, .c-editor__appicon { background: none !important; }
.c-prompt__logo img, .c-editor__appicon img { width: 100%; height: 100%; display: block; border-radius: 6px; }
.c-illus { display: block; object-fit: contain; }
.int-logo img { width: 32px; height: 32px; display: block; }

/* ------------------------------------------------------------------ */
/* Gráficas suaves + tooltips (patrón Shopify Analytics)                */
/* ------------------------------------------------------------------ */
.c-chartwrap { position: relative; }
.c-chart text { font: 11px var(--c-font); fill: var(--c-text-secondary); }
.c-charttip, .c-metrictip {
  background: #1a1a1a; color: #fff; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.24); font: 400 12px/16px var(--c-font);
}
.c-charttip { position: absolute; z-index: 5; padding: 10px 12px; min-width: 150px; pointer-events: none; }
.c-charttip strong { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.c-charttip__row { display: flex; align-items: center; gap: 6px; color: #d4d4d4; margin-top: 4px; }
.c-charttip__row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.c-charttip__row i.is-dashed { background: none !important; border-radius: 0; height: 0; width: 10px; border-top: 2px dashed; }
.c-charttip__value { display: inline-block; margin-top: 4px; padding: 1px 6px; border-radius: 6px; background: #303030; font-weight: 500; color: #fff; font-variant-numeric: tabular-nums; }
.c-metrictip { position: fixed; z-index: 9500; max-width: 300px; padding: 10px 12px; pointer-events: none; }
.c-metrictip strong { display: block; font-weight: 600; font-size: 13px; line-height: 18px; }
.c-metrictip p { margin: 2px 0 0; color: #e3e3e3; font-weight: 500; }
.c-metrictip code { display: block; margin-top: 8px; font: 12px/17px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.c-metrictip .res { color: #8fc7ff; }
.c-metrictip .arg { color: #4ade80; }
.c-metrictip .op { color: #fff; }
.c-card__title { cursor: default; }

/* Empty state de widget/gráfica (Shopify Analytics + texto de Cifra): solo texto centrado, sin icono */
.c-chart-empty { display: grid; place-items: center; flex: 1; min-height: 220px; text-align: center; color: var(--c-text-secondary); font-size: var(--c-fs-base); }
/* centrado en todo el box de la card (no solo bajo el título); el título sigue recibiendo hover */
.c-card:has(.c-chart-empty), .c-widget:has(.c-chart-empty) { position: relative; }
.c-card__body:has(> .c-chart-empty), .c-widget__body:has(> .c-chart-empty) { min-height: 272px; }
.c-chart-empty { position: absolute; inset: 0; min-height: 0; pointer-events: none; }

/* ------------------------------------------------------------------ */
/* Explorador de reportes (panel Standard/Cohorts)                      */
/* Medido en admin.shopify.com/.../analytics/reports/explore (Admin Next): */
/* panel 280px, radio 20px, tabs 36px (#ddd, activa blanca con radio    */
/* 12px 12px 0 0), bloques de 32px con radio 8px. Iconos = s-icon.      */
/* ------------------------------------------------------------------ */
.c-xlayout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.c-xlayout.is-panel-hidden { grid-template-columns: minmax(0, 1fr); }
.c-xlayout.is-panel-hidden .c-xpanel { display: none; }
@media (max-width: 900px) { .c-xlayout { grid-template-columns: 1fr; } }

.c-xpanel { background: var(--c-surface); border-radius: 20px; box-shadow: var(--c-shadow-card); overflow: hidden; display: flex; flex-direction: column; max-height: 640px; }
.c-xtabs { display: grid; grid-template-columns: 1fr 1fr; background: #ddd; flex: none; }
.c-xtab {
  all: unset; box-sizing: border-box; height: 36px; padding: 8px 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  font: 500 12.3333px/20px var(--c-font); color: var(--c-text-secondary);
}
.c-xtab s-icon { flex: none; }
.c-xtab[aria-selected="true"] { background: var(--c-surface); border-radius: 12px 12px 0 0; color: var(--c-text); font-weight: 500; }
.c-xtab:not([aria-selected="true"]):hover { color: var(--c-text); }
.c-xtab:focus-visible { outline: 2px solid #005bd3; outline-offset: -2px; }
.c-xbody { padding: 20px 11px 12px; display: grid; gap: 16px; overflow: auto; align-content: start; }
.c-xbody[hidden] { display: none; }

/* bloque con contenido (Cifra: lista de métricas, dimensiones…) */
.c-xgroup { border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; background: var(--c-surface); }
.c-xgroup__head {
  display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 6px 0 8px;
  background: var(--c-surface-subdued); font-weight: 500; color: var(--c-text);
}
.c-xgroup__head span { text-decoration: underline dotted var(--c-border-strong); text-underline-offset: 4px; }
.c-xgroup__item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; padding: 5px 8px; border-top: 1px solid var(--c-border); }
.c-xgroup__item:hover { background: var(--c-surface-hover); }
.c-xgroup__item--control { padding: 4px 8px; }
.c-xgroup__item--control > * { flex: 1; min-width: 0; }
.c-xgroup__sub { padding: 4px 8px 8px 20px; display: flex; align-items: center; justify-content: space-between; border-top: 0; color: var(--c-text); }

/* bloque vacío (estado Create custom report): solo encabezado de 32px */
.c-xblock {
  display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 6px 0 8px;
  border-radius: 8px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-border); font-weight: 500; color: var(--c-text);
}
.c-xblock--disabled { background: rgba(0,0,0,.03); box-shadow: none; color: var(--c-text-secondary); }

/* barra de acciones (Annotations / Controls) */
.c-xbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.c-pill[aria-pressed="true"] { background: #d4d4d4; }
.c-pill[disabled] { opacity: .5; cursor: default; }
.c-pill s-icon { flex: none; }

/* icono de orden en encabezados de tabla (s-icon sort) */
.c-datatable thead button s-icon { opacity: .35; }
.c-datatable thead th[aria-sort] button s-icon { opacity: 1; }

/* empty state del explorador (sin card, ilustración + texto) */
.c-xempty {
  background: var(--c-surface); border-radius: 20px; box-shadow: var(--c-shadow-card);
  min-height: 420px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 48px 24px; text-align: center;
  color: var(--c-text-secondary);
}
.c-xempty img { width: 128px; height: 128px; }

/* chart de cohortes + tabla heatmap — medidas de Shopify Analytics (reports › cohorts):
   ejes 11px #70707b, grid #eeeeef, líneas 2px, leyenda 12px, tabla 12px con filas de 36px,
   celdas con escala de azul claro (#f9fafe base, texto #0b2062). */
.c-cohortcard { background: var(--c-surface); border-radius: 20px; box-shadow: var(--c-shadow-card); overflow: hidden; min-width: 0; }
.c-cohortcard__head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px 0; }
.c-cohortcard__value { font-size: 20px; font-weight: 650; line-height: 28px; margin-top: 4px; }
.c-cohortchart { display: block; width: 100%; min-height: 290px; }
.c-cohortchart text { font: 11px var(--c-font); fill: #70707b; }
.c-cohortlegend { display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: center; padding: 8px 20px 16px; font-size: 12px; color: var(--c-text); }
.c-cohortlegend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.c-cohortlegend__more { color: var(--c-text-secondary); }
.c-cohorttable { overflow: auto; border-top: 1px solid #f2f2f2; font-size: 12px; }
.c-cohorttable table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
.c-cohorttable th, .c-cohorttable td { height: 36px; padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid #f2f2f2; background: var(--c-surface); font-weight: 400; }
.c-cohorttable thead th { color: var(--c-text); background: var(--c-surface); }
.c-cohorttable th:first-child { position: sticky; left: 0; text-align: left; border-right: 1px solid #f2f2f2; z-index: 1; min-width: 120px; }
.c-cohorttable tr.c-total th, .c-cohorttable tr.c-total td { font-weight: 600; background: #f3f3f3; }
.c-cohorttable td.h0 { background: #f9fafe; color: #0b2062; }
.c-cohorttable td.h1 { background: #eef1fd; color: #0b2062; }
.c-cohorttable td.h2 { background: #dfe6fb; color: #0b2062; }
.c-cohorttable td.h3 { background: #c9d5f8; color: #0b2062; }
.c-cohorttable td.h4 { background: #aebff3; color: #0b2062; font-weight: 600; }
.c-cohorttable th s-icon { display: inline-flex; vertical-align: -3px; }
.c-cohortfoot { padding: 10px; text-align: center; color: var(--c-text-secondary); font-size: 12px; }
.c-xempty[hidden] { display: none; }
.c-pill[hidden] { display: none; }

/* Tab activa con "orejas" cóncavas (pseudo-elementos medidos en el explorador de Shopify):
   cuadrados de 16px del color de la barra, con sombra blanca que rellena la esquina. */
.c-xtab { position: relative; }
.c-xtab[aria-selected="true"]::before,
.c-xtab[aria-selected="true"]::after { content: ""; position: absolute; bottom: 0; width: 16px; height: 16px; background: #ddd; }
.c-xtab[aria-selected="true"]::before { left: -16px; border-bottom-right-radius: 12px; box-shadow: 2px 2px 0 2px #fff; }
.c-xtab[aria-selected="true"]::after { right: -16px; border-bottom-left-radius: 12px; box-shadow: -2px 2px 0 2px #fff; }

/* Desvanecido inferior (como el borde de abajo del admin de Shopify): el contenido se difumina
   hacia el fondo al llegar al borde de la ventana. No bloquea clics. Se desactiva con <body class="no-fade">. */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 72px; z-index: 30; pointer-events: none;
  background: linear-gradient(to bottom, rgba(241,241,241,0) 0%, rgba(241,241,241,.85) 70%, var(--c-bg) 100%);
}
body.no-fade::after { display: none; }

/* Icono interno de Shopify que no existe en <s-icon> público (chart-vertical-filled): SVG extraído + máscara para heredar color */
.c-icon-mask { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: var(--icon) center / 100% no-repeat; mask: var(--icon) center / 100% no-repeat; }
.c-icon-mask--menu-horizontal { --icon: url(../assets/icons/menu-horizontal.svg); }
.c-icon-mask--chart-vertical-filled { --icon: url(../assets/icons/chart-vertical-filled.svg); }
.c-xtab .c-icon-mask { width: 20px; height: 20px; -webkit-mask-size: 16px; mask-size: 16px; }

/* Logo de marca en filas de lista (Settings › Reporting): caja de 50px con borde y logo de 26px, como en la app */
.c-brandbox { width: 50px; height: 50px; flex: none; display: grid; place-items: center; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; }
.c-brandbox img { width: 26px; height: 26px; display: block; }
.c-indextable td { vertical-align: middle; line-height: 20px; }
.c-indextable td s-badge { display: inline-flex; vertical-align: middle; }
.c-brandbox.c-brandbox--sm, .c-brandbox.c-brandbox--sm img { width: 20px; height: 20px; }
.c-indextable td s-badge { display: flex; width: max-content; }
.c-indextable td .c-author { display: flex; }

/* ------------------------------------------------------------------ */
/* Chat IA (conversación): hilo con scroll, burbuja, tabla markdown,    */
/* feedback y composer fijo. Nativo: s-paragraph, s-heading, listas.    */
/* ------------------------------------------------------------------ */
.c-chat { position: relative; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; background: var(--c-surface); border-radius: 20px; box-shadow: var(--c-shadow-card); overflow: hidden; }
.c-chat__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 6px; flex: none; }
.c-chat__scroll { flex: 1; overflow: auto; padding: 8px 24px 96px; }
.c-chat__scroll[hidden] { display: none; }
.c-chat__scroll--center { display: grid; place-items: center; text-align: center; }
.c-chat__col { max-width: 1080px; margin: 0 auto; display: grid; gap: 16px; align-content: start; }
.c-bubble { justify-self: end; max-width: 70%; padding: 8px 14px; background: #f3f3f3; border-radius: 14px; font-size: 13px; line-height: 20px; }
.c-msg { display: grid; gap: 12px; font-size: 13px; line-height: 20px; }
.c-chat__skel { display: grid; gap: 10px; }
.c-chat__skel .c-skeleton { height: 14px; }
.c-chat-table { border: 1px solid var(--c-border); border-radius: 16px; padding: 8px 16px 4px; overflow: auto; }
.c-chat-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.c-chat-table th, .c-chat-table td { padding: 8px 12px 8px 0; text-align: right; white-space: nowrap; }
.c-chat-table thead th { font-weight: 400; color: var(--c-text-secondary); border-bottom: 1px solid var(--c-border); padding-bottom: 10px; }
.c-chat-table tbody tr + tr th, .c-chat-table tbody tr + tr td { border-top: 1px solid #f2f2f2; }
.c-chat-table th:first-child { text-align: left; }
.c-chat-table tbody th { font-weight: 600; }
.c-feedback { display: flex; gap: 2px; margin-left: -6px; }
.c-composer {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 8px; width: min(576px, calc(100% - 48px)); padding: 6px 6px 6px 12px;
  background: var(--c-surface); border-radius: 9999px; box-shadow: var(--c-shadow-popover);
}
.c-composer input { flex: 1; border: 0; outline: 0; background: transparent; font: 400 var(--c-fs-base)/20px var(--c-font); color: var(--c-text); }
.c-msg s-text[type="strong"], .c-msg s-heading { font-weight: 650; }
.c-chat__head > s-clickable { display: inline-block; width: fit-content; flex: none; }

/* ------------------------------------------------------------------ */
/* Home (app actual): strip de métricas con gráfica al hover, hero,     */
/* cards con ilustración. El popover replica el del Home de Shopify:    */
/* card de 640px, radio 20px, valor 24px, título 12px/500, línea 2px.   */
/* ------------------------------------------------------------------ */
.c-home { max-width: 1108px; margin: 0 auto; }
.c-home[hidden] { display: none; }
.c-metricstrip { position: relative; display: flex; align-items: flex-start; gap: 24px; padding: 24px 0 0; }
.c-metricstrip__range { display: grid; font-size: 13px; line-height: 18px; min-width: 150px; }
.c-metricstrip__range span { color: var(--c-text-secondary); }
.c-metricstrip__items { position: relative; display: flex; justify-content: center; gap: 0; flex: 1; }
.c-mstat { padding: 0 24px; display: grid; justify-items: center; gap: 2px; outline: 0; cursor: default; }
.c-mstat__label { color: var(--c-text-secondary); font-size: 13px; line-height: 18px; }
.c-mstat:hover .c-mstat__label, .c-mstat:focus-within .c-mstat__label { color: var(--c-text); }
.c-mstat__row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
.c-mstat__row b { font-weight: 600; }
.c-mstat__delta { font-style: normal; font-weight: 500; }
.c-mstat__delta--down { color: #8e0b21; }
.c-mstat__delta--up { color: #0c5132; }
.c-mstat .c-spark { width: 30px; height: 12px; }
.c-mstat .c-spark path { stroke: #a8a8a8 !important; }
.c-mstat__pop {
  position: absolute; top: 100%; left: 50%; z-index: 60; width: 640px; max-width: calc(100vw - 32px);
  padding: 24px 24px 20px; background: var(--c-surface); border-radius: 20px; box-shadow: var(--c-shadow-popover);
  opacity: 0; visibility: hidden; transform: translate(-50%, 4px); transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.c-mstat:hover .c-mstat__pop, .c-mstat:focus-within .c-mstat__pop { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.c-mstat__head { display: flex; justify-content: space-between; align-items: flex-start; }
.c-mstat__value { font-size: 24px; line-height: 32px; font-weight: 450; font-variant-numeric: tabular-nums; }
.c-mstat__title { margin: 2px 0 0; font-size: 12px; line-height: 18px; font-weight: 500; }
.c-mstat__desc { margin: 0; color: var(--c-text-secondary); font-size: 13px; line-height: 20px; }
.c-mstat__info { position: absolute; right: 24px; top: 124px; color: var(--c-text-secondary); }
.c-mstat__pop .c-chartwrap { margin-top: 12px; }

.c-hero h2 { color: #4a4a4a; font-weight: 500; font-size: 28px; line-height: 34px; }
.c-hero p { font-weight: 600; font-size: 28px; line-height: 34px; }
.c-home__section { margin-top: 8px; }
.c-home__grid { display: grid; gap: 16px; }
.c-home__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.c-home__grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .c-home__grid--3, .c-home__grid--2 { grid-template-columns: 1fr; } .c-metricstrip { flex-direction: column; } }
.c-homecard {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px; min-height: 320px;
  padding: 20px; background: var(--c-surface); border-radius: 28px; box-shadow: var(--c-shadow-card);
}
.c-homecard--insight { min-height: 320px; }
.c-homecard--short { min-height: 200px; }
.c-homecard__title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; color: #303030; }
.c-homecard s-paragraph { color: var(--c-text-secondary); max-width: 560px; }
.c-homecard .c-homecard__actions { margin-top: auto; position: relative; z-index: 1; }
.c-homecard .c-homecard__img { position: absolute; height: auto; pointer-events: none; }
.c-homecard--insight s-paragraph { max-width: 720px; }

/* ---- Home: ajustes de espaciado, botón de card y estado hover del strip (referencia: app actual) ---- */
.c-metricstrip { padding-top: 44px; }
.c-mstat { padding: 0 45px; transition: opacity .15s ease; }
.c-metricstrip__items:hover .c-mstat:not(:hover):not(:focus-within) { opacity: .4; }
.c-mstat__pop { top: calc(100% + 10px); }
.c-mstat__pop::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.c-hero { padding-top: 86px; padding-bottom: 0; }
.c-hero h2, .c-hero p { font-size: 26px; line-height: 45px; font-weight: 500; }
.c-hero p { color: var(--c-text); }
.c-home .c-prompt { padding: 10px 10px 10px 16px; margin: 4px auto 0; }
.c-home .c-section-label { margin: 32px 0 22px; }
.c-home .c-hero + .c-home__section .c-section-label { margin-top: 12px; }
.c-homecard { gap: 14px; padding: 20px 26px; }
.c-homebtn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 16px;
  background: #fff; color: #101010; font: 500 13px/20px var(--c-font); text-decoration: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.1);
}
.c-homebtn:hover { background: #fafafa; }
.c-homebtn:focus-visible { outline: 2px solid #005bd3; outline-offset: 2px; }

/* ---- Ask bar (mismo formato que "Work with Sidekick" del Home de Shopify, con el logo de Cifra) ---- */
.c-hero h2, .c-hero p { line-height: 33px; }
.c-ask {
  display: grid; gap: 14px; max-width: 640px; margin: 20px auto 0; padding: 16px 16px 12px 20px; text-align: left;
  background: var(--c-surface); border-radius: 22px; box-shadow: var(--c-shadow-card);
}
.c-ask__input {
  width: 100%; min-height: 40px; resize: none; border: 0; outline: 0; background: transparent; padding: 0;
  font: 400 13px/20px var(--c-font); color: var(--c-text);
}
.c-ask__input::placeholder { color: #8a8a8a; }
.c-ask__bar { display: flex; align-items: center; justify-content: space-between; }
.c-ask__bar .c-prompt__logo { width: 24px; height: 24px; }
.c-ask__tools { display: inline-flex; align-items: center; gap: 4px; }
.c-ask__recents, .c-ask__btn, .c-ask__send {
  all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 6px; border-radius: 8px; font: 500 13px/20px var(--c-font); color: var(--c-text);
}
.c-ask__recents:hover, .c-ask__btn:hover { background: #f3f3f3; }
.c-ask__sep { width: 1px; height: 18px; background: #dcdcdc; margin: 0 6px; }
.c-ask__send { width: 28px; padding: 0; border-radius: 50%; background: var(--c-text); color: #fff; }
.c-ask__send[disabled] { background: #e3e3e3; color: #8a8a8a; cursor: default; }
.c-ask__recents:focus-visible, .c-ask__btn:focus-visible, .c-ask__send:focus-visible { outline: 2px solid #005bd3; outline-offset: 1px; }
/* La gráfica del strip se alinea al centro de la columna (igual que Shopify: mismo ancho y x que la caja de Ask),
   no al centro del grupo de métricas */
.c-metricstrip__items { position: static; }
.c-mstat { padding: 0 30px; }
/* Rango de fechas del strip: una sola línea, gris y regular, como "Yesterday · All channels" del Home de Shopify */
.c-metricstrip__range {
  all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; min-width: 0; white-space: nowrap;
  height: 28px; padding: 0 8px; margin: -4px 0 0 -8px; border-radius: 8px;
  font: 400 13px/18px var(--c-font); color: var(--c-text-secondary);
}
.c-metricstrip__range:hover { background: #ebebeb; color: var(--c-text); }
.c-metricstrip__range:focus-visible { outline: 2px solid #005bd3; outline-offset: 1px; }
/* Rango y comparación: dos botones independientes separados por un punto (como "Yesterday · All channels") */
.c-metricstrip__range { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 0; margin: -4px 0 0 -8px; color: var(--c-text-secondary); white-space: nowrap; }
.c-metricstrip__range:hover { background: none; }
.c-metricstrip__btn {
  all: unset; box-sizing: border-box; cursor: pointer; height: 28px; padding: 0 8px; border-radius: 8px;
  display: inline-flex; align-items: center; font: 400 13px/18px var(--c-font); color: var(--c-text-secondary);
}
.c-metricstrip__btn:hover { background: #ebebeb; color: var(--c-text); }
.c-metricstrip__btn:focus-visible { outline: 2px solid #005bd3; outline-offset: 1px; }
.c-metricstrip__range > span { padding: 0 1px; }

/* Composer del chat: misma barra que "Work with Sidekick" del admin de Shopify (píldora blanca, glow lila arriba,
   logo a la izquierda, + y botón circular a la derecha), con el logo de Cifra */
.c-composer {
  height: 46px; padding: 0 8px 0 14px; gap: 10px; width: min(640px, calc(100% - 48px));
  background: #fff; border-radius: 9999px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.14), 0 -10px 30px rgba(184,140,255,.16);
}
.c-composer .c-prompt__logo { width: 22px; height: 22px; flex: none; }
.c-composer input::placeholder { color: #8a8a8a; }
.c-composer .c-ask__btn, .c-composer .c-ask__send { flex: none; }

/* ---- Pie "From N sources" más sutil (prueba): texto pequeño y tenue + chip de fuente compacto, con el logo recortado ---- */
.c-card__footer--source { border-top: 1px solid rgba(0,0,0,.06); padding: 8px 14px 10px 16px; }
.c-card__sources { font-size: 12px; line-height: 16px; color: #8a8a8a; letter-spacing: 0; }
.c-card__footer--source .c-source {
  width: 22px !important; height: 22px !important; border-radius: 7px !important; border: 0 !important;
  background: #fff !important; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.04);
}
.c-card__footer--source .c-source img { width: 13px; height: 15px; object-fit: contain; }
.c-card__footer--source:hover .c-card__sources { color: var(--c-text-secondary); }

/* ---- Varias fuentes: chips apilados con anillo blanco (el último queda arriba) + etiqueta tenue ---- */
.c-sourcestack { display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; outline: 0; cursor: default; }
.c-sourcestack:focus-visible { outline: 2px solid #005bd3; outline-offset: 2px; }
.c-sourcestack__chips { display: inline-flex; align-items: center; }
.c-sourcestack__chips .c-source {
  width: 24px !important; height: 24px !important; border-radius: 8px !important; border: 0 !important; background: #fff !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.08); position: relative; transition: margin .15s ease;
}
.c-sourcestack__chips .c-source + .c-source { margin-left: -6px; }
.c-sourcestack__chips .c-source img { width: 14px; height: 14px; object-fit: contain; }
.c-sourcestack:hover .c-sourcestack__chips .c-source + .c-source,
.c-sourcestack:focus-visible .c-sourcestack__chips .c-source + .c-source { margin-left: 4px; }
.c-sourcestack:hover .c-card__sources { color: var(--c-text-secondary); }

/* Estado inicial del Metric tree: ilustración gris (círculo + hoja con árbol) y texto, centrado en el canvas junto al panel */
.c-canvas__empty { position: absolute; inset: 0 272px 0 0; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--c-text-secondary); text-align: center; pointer-events: none; }
.c-canvas__empty[hidden], #mt-stage[hidden], .c-canvas__zoom[hidden] { display: none; }

/* ---- Selector de fechas (réplica de s-shopifyql-date-picker): presets + calendario de 2 meses + pie con Cancel/Apply ---- */
.c-dp { display: none; width: 700px; max-width: calc(100vw - 32px); grid-template-columns: 170px minmax(0, 1fr); grid-template-rows: 1fr auto; padding: 0; overflow: hidden; border-radius: 20px; top: calc(100% + 4px); }
.c-dp[data-open="true"] { display: grid; }
.c-dp__nav { grid-row: 1 / 3; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: #fafafa; border-right: 1px solid #f0f0f0; }
.c-dp__nav hr { border: 0; border-top: 1px solid #ebebeb; margin: 8px 4px; }
.c-dp__item, .c-dp__back {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 30px; padding: 4px 10px; border-radius: 8px; font: 450 13px/20px var(--c-font); color: #303030;
}
.c-dp__item:hover, .c-dp__back:hover { background: #f0f0f0; }
.c-dp__item[aria-current="true"] { background: #ebebeb; font-weight: 550; }
.c-dp__back { justify-content: flex-start; font-size: 12px; font-weight: 550; color: #616161; margin-bottom: 4px; }
.c-dp__item:focus-visible, .c-dp__back:focus-visible { outline: 2px solid #005bd3; outline-offset: -2px; }
.c-dp__main { padding: 16px 16px 8px; min-width: 0; }
.c-dp__last { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.c-dp__last s-number-field { width: 120px; }
.c-dp__last s-select { width: 130px; }
.c-dp__last s-date-field { width: 160px; }
.c-dp__footer { grid-column: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #ebebeb; font-size: 13px; color: #303030; }
.c-dp__last { flex-wrap: nowrap; }
.c-dp__last s-number-field { width: 110px; flex: none; }
.c-dp__last s-select { width: 120px; flex: none; }
.c-dp__last s-checkbox { flex: none; white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Onboarding: panel de pasos + vista previa del dashboard + Congrats   */
/* ------------------------------------------------------------------ */
.c-ob { display: grid; grid-template-columns: minmax(380px, 34%) minmax(0, 1fr); height: calc(100vh - 54px); min-height: 560px; background: var(--c-bg); }
.c-ob[data-step="congratulations"] { display: block; height: auto; }
.c-ob__panel { background: var(--c-surface); padding: 24px 24px 0; display: flex; flex-direction: column; gap: 12px; overflow: auto; min-width: 0; }
.c-ob__panel[hidden], .c-ob__preview[hidden], .c-ob__done[hidden], .c-ob__step[hidden], .c-pv__body[hidden] { display: none; }
.c-ob__logo { border-radius: 12px; margin-bottom: 20px; }
.c-ob__eyebrow { margin: 0; font-size: 12px; line-height: 16px; color: var(--c-text-secondary); letter-spacing: .02em; }
.c-ob__eyebrow b { color: var(--c-text); font-weight: 500; }
.c-ob__title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 650; color: #303030; }
.c-ob__step { display: grid; gap: 12px; align-content: start; }
.c-ob__field { border: 0; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.c-ob__field legend { padding: 0; margin-bottom: 8px; font-weight: 500; font-size: 13px; }
.c-ob__detected, .c-ob__row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.c-ob__row { justify-content: space-between; margin-top: 8px; }
.c-ob__note { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 12px; color: var(--c-text-secondary); }
.c-ob__foot { position: sticky; bottom: 0; margin-top: auto; background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 18px); padding: 20px 0 16px; display: grid; gap: 12px; }
.c-sync { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--c-text-secondary); }
.c-sync__state { display: inline-flex; align-items: center; gap: 10px; }
.c-sync__pct { font-variant-numeric: tabular-nums; color: var(--c-text); }
.c-sync.is-done s-icon { color: #0c5132; }

.c-choicechips { display: flex; flex-wrap: wrap; gap: 6px; }
.c-choicechips button {
  all: unset; box-sizing: border-box; cursor: pointer; padding: 3px 10px; border-radius: 9999px; font: 400 12px/18px var(--c-font);
  color: var(--c-text); box-shadow: inset 0 0 0 1px #d4d4d4; background: #fff;
}
.c-choicechips button:hover { background: #f7f7f7; }
.c-choicechips button[aria-checked="true"] { background: #e8e8e8; box-shadow: inset 0 0 0 1px #d0d0d0; }
.c-choicechips button:focus-visible { outline: 2px solid #005bd3; outline-offset: 2px; }

.c-sources { border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; background: #fff; }
.c-sources__row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--c-border); }
.c-sources__row:first-child { border-top: 0; }
.c-sources__text { display: grid; flex: 1; min-width: 0; font-size: 12px; line-height: 16px; color: var(--c-text-secondary); }
.c-sources__text b { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--c-text); }
.c-brandbox.c-brandbox--md { width: 34px; height: 34px; border-radius: 9px; }
.c-brandbox.c-brandbox--md img { width: 22px; height: 22px; object-fit: contain; }

.c-ob__preview { position: relative; background: var(--c-bg); padding: 24px 56px 0; overflow: hidden; }
.c-ob__preview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; pointer-events: none; background: linear-gradient(to bottom, rgba(241,241,241,0), var(--c-bg)); }
.c-previewtag { display: inline-flex; align-items: center; gap: 8px; float: right; margin: 0 0 16px; padding: 4px 12px; border-radius: 9999px; background: #fff; box-shadow: var(--c-shadow-card); font-size: 12px; font-weight: 500; color: #4a4a4a; }
.c-previewtag i { width: 8px; height: 8px; border-radius: 50%; background: #0c7a5a; }
.c-pv { clear: both; background: #fff; border-radius: 20px 20px 0 0; box-shadow: var(--c-shadow-card); overflow: hidden; height: 100%; }
.c-pv__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--c-border); font-size: 13px; line-height: 18px; }
.c-pv__head > span:last-child { display: grid; }
.c-pv__head b { font-weight: 600; }
.c-pv__head span span { color: var(--c-text-secondary); }
.c-pv__avatar { width: 32px; height: 32px; border-radius: 8px; background: #35f0a1; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #0c3d2b; }
.c-pv__body { padding: 28px 36px 0; }
.c-pv__title { margin: 0 0 20px; font-size: 20px; line-height: 28px; font-weight: 650; color: #303030; }
.c-pv__range { margin: -8px 0 12px; font-size: 12px; font-weight: 600; color: var(--c-text-secondary); }
.c-pv__label { margin: 16px 0 8px; font-size: 12px; color: var(--c-text-secondary); }
.c-pv__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.c-pv__card { padding: 10px 14px; border: 1px solid var(--c-border); border-radius: 12px; background: #fff; min-width: 0; }
.c-pv__name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; line-height: 18px; }
.c-pv__name s-icon { color: #8a8a8a; }
.c-pv__val { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.c-pv__val b { font-weight: 650; }
.c-pv__val .c-spark { margin-left: auto; width: 100px; height: 28px; }
.c-pv__d { font-style: normal; font-weight: 600; font-size: 12px; color: var(--c-text-secondary); }
.c-pv__d::before { content: ""; display: inline-block; width: 13px; height: 13px; margin: -2px 1px -2px 0; vertical-align: middle; background: currentColor; -webkit-mask: url(../assets/icons/trend-up.svg) center / contain no-repeat; mask: url(../assets/icons/trend-up.svg) center / contain no-repeat; }
.c-pv__d--down::before { -webkit-mask-image: url(../assets/icons/trend-down.svg); mask-image: url(../assets/icons/trend-down.svg); }
.c-pv__card--list { padding: 14px 14px 8px; margin-top: 20px; }
.c-pv__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.c-pv__list li { display: flex; justify-content: space-between; padding: 12px; border-radius: 8px; font-size: 13px; }
.c-pv__list li:nth-child(even) { background: #f7f7f7; }
.c-pv__list a { color: #005bd3; }
.c-pv__list b { font-weight: 650; margin-right: 8px; }
.c-pv__card--locked .c-pv__ghost { display: flex; justify-content: space-between; margin: 10px 0 8px; }
.c-pv__ghost .c-skeleton { width: 70px; height: 12px; }
.c-pv__ghost .c-skeleton + .c-skeleton { width: 60px; }
.c-pv__connect { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-secondary); }
.c-pv__connect img { width: 14px; height: 14px; object-fit: contain; }

.c-ob__done { padding: 24px 16px 48px; }
.c-done { max-width: 800px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; background: #fff; border: 1px solid var(--c-border); border-radius: 16px; }
.c-done__art { display: grid; place-items: center; height: 220px; border-radius: 12px; background: #e3e7ff; }
.c-done__art img { height: 180.5px; width: auto; }
.c-done__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.c-stat { position: relative; display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--c-border); border-radius: 12px; font-size: 12px; color: var(--c-text-secondary); }
.c-stat b { font-size: 20px; line-height: 28px; font-weight: 650; color: var(--c-text); }
.c-stat s-spinner { position: absolute; right: 14px; bottom: 16px; }
.c-help { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--c-border); border-radius: 12px; }
.c-brandbox.c-brandbox--cal { width: 50px; height: 50px; }
.c-brandbox.c-brandbox--cal img { width: 36px; height: 36px; }
@media (max-width: 860px) { .c-ob { grid-template-columns: 1fr; height: auto; } .c-ob__preview { display: none; } .c-done__stats { grid-template-columns: 1fr; } }
.c-stat s-spinner { position: absolute !important; right: 14px; bottom: 16px; }

/* ---- Preview del onboarding con los widgets reales del dashboard (c-card KPI, footer de fuentes, s-table) ---- */
.c-pvw { box-shadow: none; border: 1px solid var(--c-border); border-radius: 16px; }
.c-pvw .c-card__body { padding: 12px 14px 8px; }
.c-pvw__head { display: flex; align-items: center; gap: 8px; }
.c-pvw__head .c-grip { color: #9a9a9a; width: 12px; }
.c-pvw .c-kpi__row { margin-top: 6px; }
.c-pvw .c-kpi__value { font-size: 18px; line-height: 26px; }
.c-pvw .c-spark { width: 90px; height: 28px; }
.c-pvw--locked .c-pvw__ghost { display: flex; justify-content: space-between; margin: 12px 0 6px; }
.c-pvw__ghost .c-skeleton { width: 70px; height: 12px; }
.c-pvw__ghost .c-skeleton + .c-skeleton { width: 60px; }
.c-pvw--locked .c-sourcestack__chips .c-source { width: 22px !important; height: 22px !important; }
.c-pvw--list { margin-top: 12px; }
.c-pvw--list .c-card__body { padding-bottom: 4px; }
.c-pvw--list s-table { margin-top: 6px; }
.c-kpi__value--sm { font-size: 13px; line-height: 20px; }
.c-pvw .c-kpi__value.c-kpi__value--sm { font-size: 13px; line-height: 20px; }

/* ---- Preview del onboarding (v2): widgets sin pie repetido, chip de fuente en la cabecera, CTA en tarjetas bloqueadas ---- */
.c-pv__filters { display: flex; gap: 8px; margin: -8px 0 18px; pointer-events: none; }
.c-pv__filters .c-pill { height: 26px; font-size: 12px; }
.c-pvw { border: 0; border-radius: 16px; box-shadow: 0 0 0 1px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05); }
.c-pvw .c-card__body { padding: 14px 16px 14px; }
.c-pvw__head { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.c-pvw__head .c-card__title { margin-right: auto; }
.c-pvw__head .c-grip { color: #a8a8a8; width: 12px; }
.c-pvw__head .c-source { width: 22px !important; height: 22px !important; border-radius: 7px !important; border: 0 !important; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.c-pvw__head .c-source img { width: 13px; height: 15px; object-fit: contain; }
.c-pvw .c-kpi__row { margin-top: 10px; align-items: flex-end; }
.c-pvw .c-kpi__value { font-size: 22px; line-height: 28px; font-weight: 650; }
.c-pvw__figure { display: inline-flex; align-items: baseline; gap: 8px; }
.c-pvw .c-spark { width: 96px; height: 30px; }
.c-pvw--locked { background: #fafafa; box-shadow: 0 0 0 1px rgba(0,0,0,.07); }
.c-pvw--locked .c-pvw__ghost { display: flex; justify-content: space-between; margin: 14px 0 12px; }
.c-pvw__ghost .c-skeleton { width: 80px; height: 14px; }
.c-pvw__ghost .c-skeleton + .c-skeleton { width: 56px; }
.c-pvw__cta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--c-text-secondary); padding-top: 10px; border-top: 1px dashed #dcdcdc; }
.c-pvw__cta .c-sourcestack__chips .c-source { width: 22px !important; height: 22px !important; border-radius: 7px !important; }
.c-pvw--list { margin-top: 12px; }
.c-pvw__table { margin-top: 10px; box-shadow: none; border-radius: 0; }
.c-pvw__table .c-indextable__scroll { padding: 0; }
.c-pvw__table td b { font-weight: 650; }
/* Congrats: el spinner va en la fila del título (arriba a la derecha), a la misma altura que "Orders synced" */
.c-stat { grid-template-columns: 1fr auto; align-items: center; row-gap: 4px; }
.c-stat > span { grid-row: 1; grid-column: 1; }
.c-stat > b { grid-row: 2; grid-column: 1 / -1; }
.c-stat s-spinner { position: static !important; grid-row: 1; grid-column: 2; right: auto; bottom: auto; }
.c-stat > span:first-child { align-self: center; }
.c-stat .c-stat__spin { grid-row: 1; grid-column: 2; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.c-stat .c-stat__spin s-spinner { position: static !important; grid-row: auto; grid-column: auto; }
