/* Inicio "Tu negocio, de un vistazo". Usa los tokens del tema: se ve bien en claro y en oscuro. */
.iv {
  --iv-radio: 16px;
  --iv-sombra: 0 1px 2px rgba(60, 30, 10, .05), 0 6px 20px rgba(60, 30, 10, .05);
  --iv-borde: color-mix(in srgb, var(--foreground) 8%, transparent);
  --iv-suave: color-mix(in srgb, var(--primary) 26%, var(--card));
  --iv-verde: #1f3d33;
  --iv-verde-texto: #f3f7f4;
  --iv-ok: #2f9e5b;
  --iv-aviso: #e59a1c;
  --iv-alerta: #d9483b;
  container-type: inline-size;
  display: flex; flex-direction: column; gap: 16px;
  max-width: 1280px; margin: 0 auto; width: 100%;
}
.dark .iv {
  --iv-sombra: 0 1px 2px rgba(0, 0, 0, .25);
  --iv-borde: color-mix(in srgb, var(--foreground) 9%, transparent);
  --iv-suave: color-mix(in srgb, var(--primary) 32%, var(--card));
  --iv-verde: #1d3a30;
  --iv-ok: #3fc07a;
}

/* ---------- Encabezado ---------- */
.iv-encabezado { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.iv-titulo { margin: 0; font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--foreground); }
.iv-saludo { margin: 4px 0 0; color: var(--muted-foreground); font-size: .95rem; }
.iv-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.iv-acciones .btn { border-radius: 10px; font-weight: 600; }
.iv-pastilla {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--iv-borde); background: var(--card); color: var(--foreground); font-size: .85rem; white-space: nowrap;
}
.iv-pastilla .icono { width: 16px; height: 16px; color: var(--muted-foreground); }
.iv-fecha { padding: 8px 14px; }

/* ---------- Tarjetas ---------- */
.iv-tarjeta {
  background: var(--card); color: var(--foreground); border: 1px solid var(--iv-borde);
  border-radius: var(--iv-radio); box-shadow: var(--iv-sombra); padding: 20px; min-width: 0;
}
.iv-tarjeta h2 { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.iv-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.iv-cabeza-nota { color: var(--muted-foreground); font-size: .85rem; }
.iv-enlace { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-strong); font-weight: 600; font-size: .9rem; text-decoration: none; }
.iv-enlace .icono { width: 16px; height: 16px; }
.iv-enlace:hover { text-decoration: underline; }

/* ---------- Indicadores ---------- */
.iv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.iv-kpi { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px; min-width: 0; }
.iv-kpi + .iv-kpi::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--iv-borde); }
.iv-kpi.destacado::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--primary); }
.iv-kpi-icono { flex: none; display: grid; place-items: center; width: 34px; height: 34px; color: var(--brand-strong); }
.iv-kpi-icono .icono { width: 26px; height: 26px; stroke-width: 1.6; }
.iv-kpi-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.iv-kpi-nombre { font-size: .85rem; font-weight: 600; color: var(--foreground); }
.iv-kpi-valor { font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.iv-kpi-nota { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted-foreground); }

.iv-punto { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-foreground); }
.iv-punto.tono-ok { background: var(--iv-ok); }
.iv-punto.tono-aviso { background: var(--iv-aviso); }
.iv-punto.tono-alerta { background: var(--iv-alerta); }

/* ---------- Filas ---------- */
.iv-fila { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.iv-lateral { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- Evolución de ventas ---------- */
.iv-total { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.iv-total strong { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.iv-total span { padding-left: 12px; border-left: 1px solid var(--iv-borde); color: var(--muted-foreground); font-size: .85rem; }
.iv-grafico { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
.iv-eje { display: flex; flex-direction: column; justify-content: space-between; height: 190px; margin-top: 28px; font-size: .75rem; color: var(--muted-foreground); text-align: right; font-variant-numeric: tabular-nums; }
.iv-eje span { line-height: 0; }
.iv-plano { position: relative; }
.iv-guias { position: absolute; left: 0; right: 0; top: 28px; height: 190px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.iv-guias span { display: block; height: 1px; background: var(--iv-borde); }
.iv-guias span:last-child { background: color-mix(in srgb, var(--foreground) 22%, transparent); }
.iv-columnas { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.iv-col { display: flex; flex-direction: column; align-items: center; min-width: 0; outline: none; border-radius: 8px; }
.iv-col:focus-visible { box-shadow: 0 0 0 2px var(--ring, var(--primary)); }
.iv-col-zona { position: relative; width: 100%; height: 218px; padding-top: 28px; box-sizing: border-box; display: flex; align-items: flex-end; justify-content: center; }
.iv-barra { position: relative; width: min(100%, 64px); border-radius: 6px 6px 0 0; background: var(--iv-suave); transition: filter .15s; }
.iv-col:hover .iv-barra { filter: brightness(1.06); }
.iv-col.hoy .iv-barra { background: var(--primary); }
.iv-barra-valor {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  font-size: .75rem; font-weight: 600; white-space: nowrap; color: var(--muted-foreground); font-variant-numeric: tabular-nums;
}
.iv-col.hoy .iv-barra-valor {
  padding: 3px 8px; border-radius: 6px; background: var(--primary); color: var(--primary-foreground); bottom: calc(100% + 10px);
}
.iv-col.hoy .iv-barra-valor::after {
  content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--primary);
}
.iv-barra-cero { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); color: var(--muted-foreground); font-size: .8rem; }
.iv-col-dia { margin-top: 8px; font-size: .78rem; color: var(--muted-foreground); white-space: nowrap; }
.iv-col.hoy .iv-col-dia { color: var(--foreground); font-weight: 700; }

/* ---------- Productos más vendidos ---------- */
.iv-productos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.iv-productos li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(60px, 1.1fr) 30px; align-items: center; gap: 12px;
  padding: 8px 0;
}
.iv-productos li + li { border-top: 1px solid var(--iv-borde); }
.iv-foto.imagen { width: 52px; height: 40px; aspect-ratio: auto; border-radius: 8px; }
.iv-foto .imagen-respaldo .icono { width: 20px; min-width: 0; }
.iv-prod-nombre { font-size: .92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-prod-pista { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--foreground) 6%, transparent); overflow: hidden; }
.iv-prod-barra { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.iv-productos li:not(:first-child) .iv-prod-barra { background: color-mix(in srgb, var(--primary) 55%, var(--card)); }
.iv-prod-cant {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong); font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------- Últimas ventas ---------- */
.iv-tabla-caja { overflow-x: auto; margin: 0 -4px; }
.iv-tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.iv-tabla th {
  text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-foreground); padding: 8px 4px; border-bottom: 1px solid var(--iv-borde);
}
.iv-tabla td { padding: 9px 4px; border-bottom: 1px solid var(--iv-borde); font-variant-numeric: tabular-nums; }
.iv-tabla tr:last-child td { border-bottom: 0; }
.iv-tabla .num { text-align: right; padding-right: 20px; }
.iv-tabla .fuerte { font-weight: 700; }
.iv-tabla .nw { white-space: nowrap; }
.iv-tabla tr.anulada td { color: var(--muted-foreground); text-decoration: line-through; }
.iv-tabla tr.anulada td:last-child { text-decoration: none; }
.iv-estado { display: inline-flex; align-items: center; gap: 7px; color: var(--muted-foreground); white-space: nowrap; }

/* ---------- Comprobantes pendientes ---------- */
.iv-pendientes { background: var(--iv-verde); color: var(--iv-verde-texto); border-color: transparent; }
.iv-pend-cifra { display: flex; align-items: center; gap: 16px; margin: 16px 0 18px; }
.iv-pend-icono { display: grid; place-items: center; padding-right: 16px; border-right: 1px solid rgba(255, 255, 255, .18); }
.iv-pend-icono .icono { width: 34px; height: 34px; stroke-width: 1.5; }
.iv-pend-cifra strong { font-size: 2.6rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.iv-pend-cifra div { display: flex; flex-direction: column; gap: 2px; }
.iv-pend-titulo { font-size: 1rem; font-weight: 600; }
.iv-pend-sub { font-size: .8rem; opacity: .75; }
.iv-pend-boton {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 14px; border-radius: 10px;
  background: #fbf3ea; color: #9b3510; font-weight: 600; text-decoration: none;
}
.iv-pend-boton .icono { width: 18px; height: 18px; }
.iv-pend-boton:hover { filter: brightness(.97); }

/* ---------- Extras ---------- */
.iv-extras { display: grid; grid-template-columns: 1fr 1fr; padding: 16px 20px; }
.iv-extra { display: flex; align-items: center; gap: 12px; min-width: 0; }
.iv-extra + .iv-extra { padding-left: 16px; border-left: 1px solid var(--iv-borde); }
.iv-extra-icono { color: var(--muted-foreground); }
.iv-extra-icono .icono { width: 24px; height: 24px; stroke-width: 1.6; }
.iv-extra-nombre { display: block; font-size: .8rem; color: var(--muted-foreground); }
.iv-extra strong { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.iv-pie { margin: 0; text-align: right; font-size: .78rem; color: var(--muted-foreground); }

/* ---------- Pantallas angostas ---------- */
@container (max-width: 900px) {
  .iv-fila { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 720px) {
  .iv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .iv-kpi:nth-child(3)::before { display: none; }
  .iv-kpi:nth-child(n+3) { border-top: 1px solid var(--iv-borde); }
  .iv-titulo { font-size: 1.45rem; }
  .iv-tarjeta { padding: 16px; }
  .iv-kpi { padding: 14px 16px; }
  .iv-kpi-valor { font-size: 1.35rem; }
  .iv-columnas { gap: 4px; }
  .iv-barra-valor { font-size: .68rem; }
}
@container (max-width: 520px) {
  .iv-col:not(.hoy) .iv-barra-valor { display: none; }
}
@container (max-width: 420px) {
  .iv-kpis { grid-template-columns: minmax(0, 1fr); }
  .iv-kpi::before { display: none; }
  .iv-kpi + .iv-kpi { border-top: 1px solid var(--iv-borde); }
  .iv-extras { grid-template-columns: 1fr; gap: 12px; }
  .iv-extra + .iv-extra { padding-left: 0; border-left: 0; padding-top: 12px; border-top: 1px solid var(--iv-borde); }
  .iv-tabla th:nth-child(1), .iv-tabla td:nth-child(1) { display: none; }
}
